Html Codes: Canvas- Move Objects by Keyboard (Walk and Jump)
If you want to create games you must know how to detect pressed key. HTML5 can make a successful connection with users' keyboard by Javascript. The following example shows how to move objects by keyboard. The code detect whether you have reached to walls and surfaces or not; if yes the movement in the direction is stopped.
Press Left or Right arrow to move and Up for jumping!
Press Left or Right arrow to move and Up for jumping!
If you don't know how to use this code or need more information Click here!
![]() | You can leave comments once you sign in/up. |