Go Down

Topic: Game for children (and those who like games) (Read 3459 times) previous topic - next topic


Hi there,
despite the fact that I'm a newbie I would like to start creating a game using the arduinos possibilities and ask for programming assistance. The rules are fairly simple because it's an old game, which will be just put into new clothes.
I created an illustration on how it's supposed to look like in the end. https://tinkercad.com/things/9R0hMauj2s5-walking-game/edit
Now actually we only need the part with the traffic light, the boxes will be chalk-drawn on the ground by a size of 30x30cm.
The game begins with a glance at the screen (blue box) where the randomly arranged steps which are allowed are displayed. Then the player moves to the green start line. The game leader presses the control button to start the game. The traffic light turns green, which means, that the player has to move to the next step. The traffic light flashes yellow, to announce that the step will be scanned. If the player has chosen the correct field, the light will turn green again, else the red light is flashing. This will be repeated unless the player has done a mistake by taking the wrong step or the player wins by entering the last field. The scanner of the position is in the green box on the bottom containing a 180° servo and a ultrasonic distance sensor. In my opinion it should be possible to calculate the field the player is standing on by checking the degree of the servo and the distance the first interruption occurs.
I'd like to use this game on any occasion for parish or street / city festivals. The total size is (4x30cm) x (10x30cm) (The space on the street needed for the steps) and app. 120(length) x 20(depth) x 80(height + some extra for the traffic light). This a non-commercial-project, we are voluntarily working on all kinds of games for the annually parish festival. If you have any ideas or might think this is an interesting project to work on, please feel free to contact me.

Regards, Uli


How will you detect which square the player has moved to?


Sep 25, 2013, 05:46 am Last Edit: Sep 25, 2013, 06:06 am by lightview Reason: 1
For I´m no programmer, I can only say it the way, I would procede.
Let´s say the game starts and the traffic light turns to green, that means, the player has 5-10 sec.s to move to the next field. After that time the player has to stay there while the orange lights are flashing for 5 sec.s which means, that the scanning process is running. During the scanning process the field the player stands on will be detected. If it´s correct, the lights turn back to green and one can continue, else the lights turn to red and game over.
Here is a small way, I would put it in computer language:
1. create random fields on the 10x4 score board
2. display to screen for the player
3. wait for start button to be pressed
4. turn traffic light to green and wait for 10 seconds.
5. flash orange light for 5 seconds and scan fields by checking the distance and angle degree (see image)
6. if player stays on a field that is allowed and didn´t finish all steps turn traffic light to green (go to 4)
6a. if player stays on the last fields and wins flash all lights and play sound
6b. else turn traffic light to red and play sad sound

The image shows how to identify the field by turning the ultrasonic sensor (for distance) on a servo (don´t know the english term) and by this procedere detects the field. Keep in mind, that the square field are all 30x30, so a calculation should be possible.
One way, for I´m sure there is a nicer one, would be for example:
turn servo to 1°
if ultrasonicsensor measures distance between 5cm and 25cm player is supposed to stay on field a
if ultrasonicsensor measures distance between 26cm and 50cm player is supposed to stay on field b
if ultasonicsensor measures distance between 51cm and 75cm player is supposed to stay on field c
turn servo to 5° .....


The description of your project is quite appropriate.
The steps you have listed are nearly in pseudo-code, you can easily  "translate" them in code .
The idea of the ultrasonic sensor on the servo works ( i have used the same technique on a little project, accuracy was not 100%, but enough for my needs).
To semplify the detection of the player position on the field, I suggest you to put the servo on a corner of the field game and rotate it from 0 to 90 degree .


Alright, still looking for programming assitance. Tried the single modules with the example files on the arduino and they are working. Here are a couple of images of the "hardware" so far.
Back: Here you can see the whole machine.
Front: only part, within the wood part are 4 ultrasonic sensors build in.
Interior: just to see, that everything is well connected.
Top: The most interesting part.
3 Bulbs for the traffic-lights
2 buttons (one to start the game, one for just in case)
1 nokia 5110 display
1 power button
The programm I would like to ask for assistance should do something like this:
power on!
1) arrange fields (10 for each sensor (after 3.2m the ultrasonic devices are giving out horrible values)
i.e. sensor 1 field 1 measurement 1-30cm, field 2 measurement 31-60cm...
till you get 40 fields
2) create randomly arranged "forbidden" steps
display 1 +2 to nokia display
3) by pressing the start button scan the steps (turn traffic light to orange) and if correct field
turn traffic light to green again, else turn red

Go Up