Please I need to know how I did move an object 5 pixels each time I pressed a button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please I need to know how I did move an object 5 pixels each time I pressed a button

5th Apr 2019, 1:19 PM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar
4 Answers
+ 15
Johan Alejandro Arena Hey, I assume you are using JavaScript for this type of work :) Show us your code then we can elaborate more :)
5th Apr 2019, 1:35 PM
r8w9
r8w9 - avatar
+ 4
1. Declare the pos in the global scope. 2. Increment pos 3. getElements return an array, so you need to add [0] 4. style.left and remember to add "px" https://code.sololearn.com/WJiVeZGZssjv/?ref=app
5th Apr 2019, 1:54 PM
Gordon
Gordon - avatar
+ 3
Please post an attempt first So that we can help you at where you are stuck at
5th Apr 2019, 1:35 PM
Gordon
Gordon - avatar
0
I need help to know how I can move just an example with a button of the rest I'll take care of https://code.sololearn.com/WZ38gzoSc4Gh/?ref=app
5th Apr 2019, 1:42 PM
Propy Grammar Moruzian
Propy Grammar Moruzian - avatar