Hi,
I have seen some game where there are two sprites, and if you press the "2" key, the second sprite is playable. How do you program that to happen? Thank you for you help in advance.
Best Regards,
mrdance62
Offline
mrdance62 wrote:
Hi,
I have seen some game where there are two sprites, and if you press the "2" key, the second sprite is playable. How do you program that to happen? Thank you for you help in advance.
Best Regards,
mrdance62
You mean having two people able to play on the same computer, right?
Well, that is very easy, you just assign the player two sprite to have movement, just like the player one sprite, except with different keys. A popular second set is W, up, S, down, A, left, and D, right.
Regards,
CAA14
Offline
CAA14 wrote:
mrdance62 wrote:
Hi,
I have seen some game where there are two sprites, and if you press the "2" key, the second sprite is playable. How do you program that to happen? Thank you for you help in advance.
Best Regards,
mrdance62You mean having two people able to play on the same computer, right?
Well, that is very easy, you just assign the player two sprite to have movement, just like the player one sprite, except with different keys. A popular second set is W, up, S, down, A, left, and D, right.
Regards,
CAA14
That's exactly what I mean, yet what about the part where you press the "2 key? Is that automatic?
Offline
mrdance62 wrote:
CAA14 wrote:
mrdance62 wrote:
Hi,
I have seen some game where there are two sprites, and if you press the "2" key, the second sprite is playable. How do you program that to happen? Thank you for you help in advance.
Best Regards,
mrdance62You mean having two people able to play on the same computer, right?
Well, that is very easy, you just assign the player two sprite to have movement, just like the player one sprite, except with different keys. A popular second set is W, up, S, down, A, left, and D, right.
Regards,
CAA14That's exactly what I mean, yet what about the part where you press the "2 key? Is that automatic?
The "2 key"? You mean the player two keys? If so, then yes, that's all you need to do to have the second sprite controlled by a second player. Of course, you would have a lot of other scripts that, for example, tell the sprites when they can and cannot be controlled(like on a menu), but yeah, that will work.
Here's the scripts you could use:
set [gamePlaying? v] to [yes] when i receive [game start v] repeat until <(gamePlaying?) = [no]> if <key [up arrow v] pressed?> change y by [3] end if <key [down arrow v] pressed?> change y by [-3] end if <key [left arrow v] pressed?> change x by [-3] end if <key [right arrow v] pressed?> change x by [3] end end
when i receive [game start v] repeat until <(gamePlaying?) = [no]> if <key [w v] pressed?> change y by [3] end if <key [s v] pressed?> change y by [-3] end if <key [a v] pressed?> change x by [-3] end if <key [d v] pressed?> change x by [3] end endYou see?
Last edited by CAA14-NL (2013-04-23 13:36:57)
Offline