Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. vehicle a = new vehicle(5);
  2. class vehicle{
  3. int xPos;
  4. int yPos;
  5. vehicle(int tempyPos){
  6. xPos = 0;
  7. yPos = tempyPos;
  8. }
  9. void display(){
  10. fill (0,0,255);
  11. rect(xPos,yPos,xPos+10,yPos+10);
  12. }
  13. void move(){
  14. xPos++;
  15. }
  16. }
  17. void setup(){
  18. size(500,500);
  19. }
  20. void draw(){
  21. background(255);
  22. a.display();
  23. if(key == 'd'){
  24. a.move();
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement