Controlling with w and s

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jgordon
Posts: 4
Joined: Mon Jan 13, 2014 4:18 pm

Controlling with w and s

Post by jgordon » Mon Jan 13, 2014 4:22 pm

My partner and I are trying to create a two player pong game. We were able to get the right paddle to move and reset according to the size of the card. It moves with the up and down arrow keys. We were wondering how to make the left paddle move with w and s.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10341
Joined: Wed May 06, 2009 2:28 pm

Re: Controlling with w and s

Post by dunbarx » Mon Jan 13, 2014 4:35 pm

Hi.

Do you mean the "w" and "s" keys? That when you press either of those the paddle will move?

If so, try this in the card script:

Code: Select all

on keydown var
   put var
end keydown
When you hit a key, its value appears in the message box. Can you take this idea and make your paddle work? You may want to filter so that only those two keys work this way, and do think about whether you ever want to type text into a field. Write back if you need more...

Craig Newman

jgordon
Posts: 4
Joined: Mon Jan 13, 2014 4:18 pm

Re: Controlling with w and s

Post by jgordon » Mon Jan 13, 2014 7:45 pm

Thank you!

Post Reply