+ 2

Java Processing - Click Button for movement

I wrote an entire program and got s button to appear. I want it to operate as an upButton. But i cant quite figure out exactly how do i link the button yo the movement of my player…. Someone please give my player life!!! i need my character to work from clicking the up button that i created. This is a phone game so there is no keyboard.

5th Jul 2021, 2:03 AM
NerdyBoySteve
NerdyBoySteve - avatar
4 Antworten
+ 1
This sort of code shall work xVel=0; yVel=0; void draw(){ If pressed.up(){ yVel = -speed} ... ... all four buttons ... Player.x += xVel Player.y += yVel Lerp(xvel and yvel) Hope this helps
6th Jul 2021, 6:15 AM
Bhavik Mahalle
Bhavik Mahalle - avatar
+ 1
Thank You so much ill try it ive been trying to respond to you but sololearn says i haveny sctivated my account even though i already have …. i will definitely try this and see if it works!!! This is my button currently :
6th Jul 2021, 10:28 AM
NerdyBoySteve
NerdyBoySteve - avatar
+ 1
welp the app wont let me paste a portion of my code either…. this is extremely unfortunate…. im sorry thank you for your help….
6th Jul 2021, 10:33 AM
NerdyBoySteve
NerdyBoySteve - avatar
+ 1
I am still here
8th Jul 2021, 8:55 AM
Bhavik Mahalle
Bhavik Mahalle - avatar