How can I move the lower brick in canvas using buttons? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I move the lower brick in canvas using buttons?

Also, are there other way to move it like dragging or joystick? https://code.sololearn.com/W0b432551gKV/?ref=app

26th Jul 2018, 4:01 AM
Alquen
Alquen - avatar
7 Answers
+ 4
Alquen Sarmiento , I have made a similar game before. I used touch events because it reacts faster than button clicks. I hope this could help. https://code.sololearn.com/W5SKO1x98R7h/?ref=app
26th Jul 2018, 7:37 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 2
JonathanP Thanks for the idea. I'll study it first before implementing it.
26th Jul 2018, 8:50 AM
Alquen
Alquen - avatar
+ 1
I deleted the animation for the lower brick. How can I move it efficiently?
26th Jul 2018, 6:23 AM
Alquen
Alquen - avatar
+ 1
I tried adding function that add and subtract the value of x but Im having a problem with its scope.
26th Jul 2018, 6:35 AM
Alquen
Alquen - avatar
+ 1
Leszek Nothing for a while
26th Jul 2018, 8:49 AM
Alquen
Alquen - avatar
0
Don't animate lower brick. Code it reaction either to buttons or set listeners for keys on keyboard.
26th Jul 2018, 5:16 AM
Lstiti
0
Does the buttons do anything?
26th Jul 2018, 7:13 AM
Lstiti