Someone change this code but make it stay the same

please format code with </> button * homework policy * asking questions

int radius = 12;
int direction = 1;
int direction2 = 0;

float x = 250;
float y = 250;

void setup() {
size(500, 500);
ellipseMode(RADIUS);
}

void draw() {
background(255);
fill (230, 230, 0);
smooth ();
noStroke();
render();

}

void keyPressed() {
if (key == CODED) {
if (keyCode == LEFT) {
x = x - 10;
direction = -1;
direction2 = 0;
}
else if (keyCode == RIGHT) {
x = x + 10;
direction = 1;
direction2 = 0;
}
else if (keyCode == UP) {
y = y - 10;
direction = 0;
direction2 = -1;
}
else if (keyCode == DOWN) {
y = y + 10;
direction = 0;
direction2 = 1;
}
}
}

void render() {
for ( int i=-1; i < 2; i++) {
for ( int j=-1; j < 2; j++) {
pushMatrix();
translate(x + (i * width), y + (j*height));
if ( direction == -1) {
rotate(PI);
}
if ( direction2 == 1) {
rotate(HALF_PI);
}
if ( direction2 == -1) {
rotate( PI + HALF_PI );
}
arc(0, 0, radius, radius, map((millis() 500), 0, 500, 0, 0.52), map((millis() 500), 0, 500, TWO_PI, 5.76) );
popMatrix();
// mouth movement //
}
}
}

Hey, that looks familiar!

How do you expect the code to change but also be the same? If it changes, wouldn’t it be different?

2 Likes
static final int[] kcs={LEFT,RIGHT,UP,DOWN};float x=250,y=250;
static final int[] dxs={-1,1,0,0};static final int[] dys={0,0,-1,1};
static final float[] drs={PI,0,-HALF_PI,HALF_PI};int d=1,r=12;
void setup(){size(500,500);ellipseMode(RADIUS);noStroke();fill(230,230,0);}
void draw(){background(0);x+=dxs[d];y+=dys[d];translate(x,y);rotate(drs[d]);
arc(0,0,r,r,map((millis()%500),0,500,0,0.52),map((millis()%500),0,500,TWO_PI,5.76)
);}void keyPressed(){for(int i=0;i<4;i++){if(key==CODED&&keyCode==kcs[i]){d=i;}}}

There you go. It’s different, but the same. And better. Or worse? I can’t tell.

No one is sure what you want because you really didn’t tell us what you wanted.

Hey can you make me a game which you have made the can be moved with arrows and has a game over please

Yes I could - but I am not going to

Do your own homework :disappointed:

Please mate I can’t do it

That’s tough but doesn’t explain why I should help you cheat through plagiarism.

Perhaps you should be more studious and try harder.

1 Like

making other people do your homework is just dumb, how are you learning from this. You should try to do the homework yourself first and then we all can help you. without you not doing anything and expecting us to do everything for you; is ludicrous.

1 Like

Hi I’m sorry if I made it look that way but I’ve made my own game and just wanted to see how someone else has done it differently.
I would honestly not cheat I am just doing this for fun sorry to made it have seem if I was cheating.

In your first post you present someone else’s code and ask for someone to modify it so its origin is masked.

When that didn’t work you asked for someone to write the program for you.

When challenged you said

Now you say that you have created a program but you want to see how someone else would do it differently.

You really expect me to believe that !!! - you must think I am an idiot.

Prove me wrong - post your code here and be prepared to answer detailed questions about it.

1 Like

You can be that someone!

All the resources (tutorials, examples, references, books, etc.) you need are here:

You should work through the tutorials and examples and start writing your own code.

Also look for “Coding Train” videos on YouTube.

:)