Reputation: 21
I am new to assembly and trying to build a kind of pong game where a ball hits the wall and we use a paddle to reflect the ball back towards the wall. I am using the Irvine32 library in this project and using the "ReadChar" to accept a input from the user and move the paddle accordingly. But during this procedure, I want the ball to keep moving. Is there any way to wait for the user Input for a specific amount of time then move on with the program so that I can move the ball? If not, is there any other way this behaviour can be achieved?
I will add a small snippet of the code below which should show enough about the working of the program.
.code
main PROC
call DrawPlayGround
call DrawPlayer
call DrawBall
gameLoop:
call ReadChar
mov inputChar, al
; exit Game if user types "x"
cmp inputChar,"x"
je exitGame
cmp inputChar,"w"
je moveUp
cmp inputChar,"s"
je moveDown
moveUp:
call UpdatePlayerUP
dec yPosPlayer
call DrawPlayer
jmp gameLoop
moveDown:
call UpdatePlayerDOWN
inc yPosPlayer
call DrawPlayer
jmp gameLoop
jmp gameLoop
exitGame:
exit
main ENDP
Please excuse me if this is a silly question as I am a beginner and thank you for taking the time to answer the question.
Upvotes: 1
Views: 41