Move an object
Create an object.
rm::Object player;
When you are moving an object the structure must be this one:
- Clear the screen, you can do this with the Clear function or you can do it manually by printing an --empty string.
-Move the object
-Printing the object
Moving the object:
To do this, increment the x or y value of the object you created before:
player.x++;
Now use the move function from the Object class we created before.
player.move();
This function needs two values, the x position and the y position.
player.move(player.x , player.y);
you can use your own variables for x and y but I recommend to do it this way in order to use the distance function.
Comments
Post a Comment