Advertisement
Guest User

Raidovan

a guest
Dec 8th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.31 KB | None | 0 0
  1. x = 4;
  2. y = 4;
  3. accx = 1;
  4. accy = 1;
  5. w = 7;
  6. h = 7;
  7. void setup() {
  8.   // put your setup code here, to run once:
  9.  
  10. }
  11.  
  12. void loop() {
  13.   // put your main code here, to run repeatedly:
  14.   if (x<=0 or x>=w){
  15.     accx=-accx;
  16.   }
  17.    if (y<=0 or y>=h){
  18.     accy=-accy;
  19.   }
  20.   x += accx;
  21.   y +=accy;
  22.  
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement