Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Basic player movement
<!DOCTYPE html> <html> <!--Scripted by: DMilkaSTD--> <head> <title>Basic player movement</title> <meta charset="UTF-8"/> </head> <body> <!--Css--> <style> #player { background-color: red; height: 60px; width: 60px; position: relative; left: 0px; } .string { background-color: black; color: white; font-family: arial; border: 2px solid grey; border-radius: 5px; } * { margin: 5px; } </style> <!--Javascript--> <script> var move = 10 var position = 0 function left() { position = position - move document.getElementById("player").style.left = position + "px"; } function right() { position = position + move document.getElementById("player").style.left = position + "px"; } </script> <!--Html--> <div id="player"></div> <div align="center"> <button type="button" onclick="left()"><</button> <button type="button" onclick="right()">></button> <br/> <span class="string">Use the buttons to move the player</span> </div> </body> </html>
run
|
edit
|
history
|
help
5
Please
log in
to post a comment.
Regex Generator For Annish
rexinsrexCOMIC
Search engine
Task selector
Search engine
nice floppy disk animation
Client Side!
HTML5 Button
rexinsrexinsrex
Hi
Please log in to post a comment.