Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vehicle a = new vehicle(5);
- class vehicle{
- int xPos;
- int yPos;
- vehicle(int tempyPos){
- xPos = 0;
- yPos = tempyPos;
- }
- void display(){
- fill (0,0,255);
- rect(xPos,yPos,xPos+10,yPos+10);
- }
- void move(){
- xPos++;
- }
- }
- void setup(){
- size(500,500);
- }
- void draw(){
- background(255);
- a.display();
- if(key == 'd'){
- a.move();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement