Hi all, I really need some help as I am pulling out what little hair I have left. I have programmed a simple game where by 2 "tanks" chase each other around an arena playing tag. It seemed to be working but for some reason, since programming in the controls for player 2, player 1 won't move. The broadcast to change costume works, but no movement which kind of defeats the object of a game of tag!
Where have I gone wrong? The scripts for both sprites are the same (apart from the controlling keys of course).
Offline
http://scratch.mit.edu/projects/Firedrake969/2925625
Somewhat complicated, but I believe this may work. only 1s1s.
Offline
Somewhat, just looking at that has given me a headache!...I really thought it would be much simpler, just assign different keys to control the different sprites. Might have to think about another control device.
Offline
OK, so what I have at the moment is something like this:
when gf clicked go to x: -234 y: -180 set player1 to 0 forever if key q pressed? change y by 10 if key a pressed? change y by -10 if key z pressed? change x by -10 if key x pressed? change x by 10 if key s pressed? rotate anti-clockwise 15 degrees if key d pressed? rotate clockwise by 15 degrees When f pressed Broadcast Ram2 When I receive Ram2 switch to costume2 wait 1 secs switch to costume1 if touching Sprite2 change player1 by 1The exact same script for player 2 apart from different keys being pressed etc.
Offline
Muttley1 wrote:
OK, so what I have at the moment is something like this:
when gf clicked go to x: [-234] y: [-180] set [player1 v] to [0] forever if <key [q v] pressed?> change y by [10] end if <key [a v] pressed?> change y by [-10] end if <key [z v] pressed?> change x by [-10] end if <key [x v] pressed?> change x by [10] end if <key [s v] pressed?> turn ccw [15] degrees end if <key [d v] pressed?> turn cw [15] degrees end When key [f v] pressed Broadcast [Ram2 v] When I receive [Ram2 v] switch to costume [costume2 v] wait [1] secs switch to costume [costume1 v] if <touching [Sprite2 v]?> change [player1 v] by [1] endThe exact same script for player 2 apart from different keys being pressed etc.
I am still confused by your problem. Let me check out your project to see what's wrong.
With regards,
~7734f
Offline
Muttley1 wrote:
OK, so what I have at the moment is something like this:
when gf clicked go to x: [-234] y: [-180] set [player1 v] to [0] forever if <key [q v] pressed?> change y by [10] if <key [a v] pressed?> change y by [-10] if <key [z v] pressed?> change x by [-10] if <key [x v] pressed?> change x by [10] if <key [s v] pressed?> turn ccw [15] degrees if <key [d v] pressed?> turn cw [15] degrees end end end end end end When [f v] key pressed Broadcast [Ram2 v] When I receive [Ram2 v] switch to costume [costume2 v] wait [1] secs switch to costume [costume1 v] if <touching [Sprite2 v]?> change [player1 v] by [1] endThe exact same script for player 2 apart from different keys being pressed etc.
Fixed.
Last edited by Liamadams (2013-04-22 15:35:38)
Offline
Muttley1 wrote:
Now, anyone got any ideas on how to set a time limit?
Yes. All you need is to reset the timer at the beginning of each round, figure out which scripts you want to "quit" once you reach the time limit, and change them so that they're more like this:
wait until <(timer) < [limit]>//Precautionary. Only if you want/need it. forever if <(timer) < [limit]> Scripts... end
Offline