I am making a simple game in which you try to destroy the other player (you are a UFO). Player 1 moves with W, A, S, and D, and Player 2 moves with the UP, DOWN, LEFT, and RIGHT arrow keys. Player 1 shoots with 1 and Player 2 shoots with 7. I know, it's not the best controls, but I'll figure that out later. It works for now. xP
The problem:
If both players are shooting at the same time, then neither player can move left. Here is my code:
def move
if button_down?(@nk)
@y -= speed
end
if button_down?(@sk)
@y += speed
end
if button_down?(@wk)
@x -= speed
end
if button_down?(@ek)
@x += speed
end
end
@ek = east key (the trouble causing button, moves left)
@nk = north key (moves up)
@sk = south key (moves down)
@wk = west key (moves right)
Two very odd things here:
• It is only with the var @ek (a completely different button for the two players)
• If I move the @ek conditional to the top of the list, I still get the same results.
Help would be much appreciated. :/
Loading...