Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = 4;
- y = 4;
- accx = 1;
- accy = 1;
- w = 7;
- h = 7;
- void setup() {
- // put your setup code here, to run once:
- }
- void loop() {
- // put your main code here, to run repeatedly:
- if (x<=0 or x>=w){
- accx=-accx;
- }
- if (y<=0 or y>=h){
- accy=-accy;
- }
- x += accx;
- y +=accy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement