Trying to make a google dinosaur game rip-off?

Well, flappy bun??
The problem I have is that the image instead of going up and down—it stretches…
Here’s the code!

float bunHeight = 2;
float speed = 1;
PImage bun;

void setup() {
size(500,500);
bun = loadImage(“Bun.png”);
}

void draw() {
//clear the screen/background?
background(255);
//draw the ball
image(bun, 10, 10, width/2, bunHeight/2);
//modify the ball’s height
bunHeight += speed;
//increase speed

//bounce
if(bunHeight/2 > height) {
bunHeight = height;
}
}

hi @CyanNi

nice try for your first game,

but you did not format your code,
and you did not link to


and so it took some time to make that missing image

Bun.png

now the revenge!
you not get my code, only a picture!

p.s. the real game use this


how can we use that?
https://docs.oracle.com/javase/1.5.0/docs/api/java/awt/Graphics.html#drawImage(java.awt.Image,%20int,%20int,%20int,%20int,%20int,%20int,%20int,%20int,%20java.awt.image.ImageObserver)

1 Like

Thank you, I’m sorry for bothering you…but wow I just wanted to know how to make it stop streching you went beyond…??

I want to embed this Google Chrome game on my website. Is there any advice? I don’t want to put the entire in the word press, I just need the embedded frame from another website.
I got this code code from one of the website, but and I did try to put it on my mine, but it is showing me the error.
“Display forbidden by X-frame options”

Code I am trying to embed is - <h3 Google Dinosaur Game

From what I see <iframe src="https://www.dinogame.net/game/"></iframe>; should work.

Also, this isn’t really related to Processing, so it might be better asked on StackOverflow or similar Q&A websites.

iFrame is being depricated almost universally across the web as it’s a security concern.

Sarah is right, it’s not really a good idea to jump into a thread with your own question but to make your own, and what you’re asking for is off topic.

However, far be it from me to shoot down someone’s ideas and not suggest an alternative… If you press F12 on the offline screen in google chrome you might be able to inspect and extract the html and javascript in the debugger to find more information on how to take the code of the game and use it in your own website. There’s a chance that it’s part of the browser program itself and not just a web frame though, so you may be out of luck and have to make a recreation of your own.

p5js would be a great start for that.

1 Like

Your problem is this line: image(bun, 10, 10, width/2, bunHeight/2);. The parameters of image are this:
(image, x position, y position, width, height). You are changing bunHeight, which is the parameter you are using to set the height, not the y position. Try replacing the second 10 with bunHeight, and setting the last parameter to a fixed number.

This post has already been answered by kll it just got bumped recently by someone else.

1 Like