Code structure for turn based action game
I have an idea for a game structure, but I wanted to see if some of the experts had insights into how it should be structured.
My idea is this: A two player air hockey game that is simultaneous turn based. In short, the action would occur in maybe 2 second intervals and in between each round players would have 2-5 seconds to select where they would like to move their paddle to (within range) and then the action continues for a few more seconds. I think it could be an interesting way to remove reaction time from a classic game and insert more strategy. Maybe more kid friendly too.
Anyway, when considering this I thought about using a Timer as the master loop, but I'm not sure how I would freeze and unfreeze the puck and/or paddle movement without saving and reloading attributes each cycle.
Any thoughts?
Thanks!
H
My idea is this: A two player air hockey game that is simultaneous turn based. In short, the action would occur in maybe 2 second intervals and in between each round players would have 2-5 seconds to select where they would like to move their paddle to (within range) and then the action continues for a few more seconds. I think it could be an interesting way to remove reaction time from a classic game and insert more strategy. Maybe more kid friendly too.
Anyway, when considering this I thought about using a Timer as the master loop, but I'm not sure how I would freeze and unfreeze the puck and/or paddle movement without saving and reloading attributes each cycle.
Any thoughts?
Thanks!
H
Best Answer
-
fadamion Posts: 309
Well for the puck have a stop attribute and when the stop is activated by the timer record x,y then lock puck to that x,y also record the speed of the puck and the angle (vector to angle) it was traveling at.
So attributes of:
stop
speed
angle
Then just keep turning then on and off with the timer.
Answers