Processing Onscreen D-Pad to Move Character (buttons)

Good Afternoon! Everyone,

Im currently working on a game and I have been all over the internet looking for footage on how to program a Onscreen ( Directional-Pad Button(s) ) using the Processing Library!

And when l tell there is absolutely noone explaining or who seems to know how to do this… It blows my mind…. Everyone knows how to make Key Events… but hardly anyone seem to have knowledge on how to make mouse/touch event D-Pad to simply make a player class object move…

In my concept illustration below I’ve sketched exactly what i mean and hope to achieve…

It’s what Id feel was a fundamental level idea… All i need is a D-Pad that make the player (Rect/ellipse) move upon being touched…

if anyone can do this or help me understand it would be a huge blessing… once i see the code i can understand it easily…

but oddly there are hardly anyone taking the mobile touchscreen direction in their lessons…

I humbly ask that someone here help me out here…

V/r

AMN Fletcher

Start here https://processing.org/examples/button.html

Check https://processing.org/tutorials/interactivity/

1 Like

Hey, I Humbly Thank You Sir!

I literally was on this last night snd i just got so frustrated when you sent me this link lololol because I’m like man… I’ve already utilized this example…

But, then i altered the code a little bit and I’ve created a line that actually make my character move according to mouse clicks…

my only issue is ….2 things…

First I need the character to move when i click a button and im not sure how can i make a button connect to my code Below…

float x = 0;
float y = 0;

void setup() {
size(375, 375);
}

void draw() {
background(255);
fill(0);
rect(x,y, 25,50);
}

void mousePressed() {
x += 1;
}

Again, Thank you for that match! It struck a Fire !

Im curious how can i make this code Ive created reacted to a right button being pressed!

Nevermind I literally just went to a tutorial online and Figured it out lolol

Im overthinking and was adding far too many steps i just wrote a code that connected everything!!!

Im good to go!!!

thank you for responding earlier it helped give me that push i needed!!

2 Likes

Congrats!

Can you post your code?

Hello,

Can you post a link to tutorial? It may help others…

I don’t need or want to see your code… I am more interested in the journey and how you got there.

:)