We are about to switch to a new forum software. Until then we have removed the registration on this forum.
PLS help me how to make this collision :( i create, but i want to disable or anable one side move....
But where is AWSD move ? i must have colission with left up down right side :|
Do you have a working sketch? Post your current code or an example of what you're working with.
int left, up, down, right; boolean goleft, goup, godown, goright; int playerY, playerX, speed = 1; void setup() { size(300, 300); } void draw() { noStroke(); background(0); goleft = true; godown = true; goright = true; goup = true; if(playerX + 20 >= 100)goleft = false; // r1 right edge past r2 left if(playerX <= 100 + 100)goright = false; // r1 left edge past r2 right if(playerY + 20 >= 150)godown = false; // r1 top edge past r2 bottom if(playerY <= 150 + 100)goup = false; // r1 bottom edge past r2 top if(goup)playerY -= up * speed; if(godown)playerY += down * speed; if(goleft)playerX -= left * speed; if(goright)playerX += right * speed; fill(255); rect(150, 100, 100, 100); fill(125); rect(playerX, playerY, 20, 20); } void keyPressed() { if (key == 'a' || key == 'A') { left = 1; } if (key == 'd' || key == 'D') { right = 1; } if (key == 'w' || key == 'W') { up = 1; } if (key == 's' || key == 'S') { down = 1; } } void keyReleased() { if (key == 'a' || key == 'A') { left = 0; } if (key == 'd' || key == 'D') { right = 0; } if (key == 'w' || key=='W') { up = 0; } if (key == 's' || key == 'S') { down = 0; } }
help :(
Answers
But where is AWSD move ? i must have colission with left up down right side :|
Do you have a working sketch? Post your current code or an example of what you're working with.
help :(