it’s difficult to find out what’s wrong. If you tell us what you tried to do and what will be the game we could help you by either showing you the issue or resolving it by changing the code.
I’ve adapted @CodeMasterX’s code a bit. As you can see I take every point/measurement in relation to width and height. That is necessary for Android because you want to use fullscreen, and there exist an enormous variety of screen sizes. This code has a fixed canvas size and you need to change it. The idea is to use three fingers to steer. The ring finger for moving to the right, the index finger for moving to the left, and the middle finger to jump by tapping above the buttons. To jump and move simuataniously you need the Android’s buildin touches array. But the sketch is too small on my phone to test it. So change it to fullscreen and we’ll see.
float x = 300, y = 100, w = 50, h = 50, xs = 0;
float ys = 0, g = 0.5, speed = 0.5, ox1 = 200;
float oy1 = 500, ow1 = 200, oh1 = 20, friction = 0.97;
int cv;
boolean jump = true;
void setup() {
size(600, 600);
textSize(30);
cv = height-height/12;
fill(0, 220, 220);
rect(0, cv, width, height/12);
fill(0);
line(width/2, cv, width/2, height);
fill(100);
textSize(20);
text("Left", width/5, height- height/30);
text("Right", 11*width/16, height-height/30);
}
void draw() {
fill(0);
rect(0, 0, width, cv);
fill(255);
rect(x, y, w, h);
rect(ox1, oy1, ow1, oh1);
if (jump) {
ys += g;
y += ys;
xs *= friction;
x += xs;
if (y+h > oy1) {
ys = 0;
y = oy1-h;
jump = false;
}
}
if (mousePressed) {
if (mouseY > cv) {
if (mouseX > width/2) x += 5;
if (mouseX < width/2) x -= 5;
} else {
jump = true;
if (ys == 0) {
ys -= 10;
}
}
}
}
As the image is a landscape use that orientation. You’ll have to take the image to GIMP or similar and cut out the dinosaur-rider and save it as a transparent png image. Then correct the hole in the background image with appropriate colors. Load the image into the sketch and use it in the background. You need to search the button positions relative to width and height. (To make it work on every phone) Post it here (!!formatted in a code-block!!), then I’ll help you further.
Edit: Where is the jump button? Or has it to jump when you shake your phone?
Yes for example instead of writing rx = 200; you write something like rx = width/4;
Then if it works on your phone screen resolution, it will also work on other sizes.