Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // making the paddle only
- //comments below could be stuff you can say
- void setup() { //always start your code here
- size(400, 400); //creating a "canvas", horizontal 400 x vertical 400
- }
- float paddleX = 20; //the paddle is the thing you move
- float paddleY = height-15;
- void draw() {
- background(255, 255, 255); //DONT SHOW THIS YET, AND SHOW WHAT HAPPENS: this line is placed so that it refreshes.
- rect(paddleX, paddleY, 30, 10); //review coordinate system, draws a rectangle at coordinates (paddleX, paddleY) to (30, 10)
- }
- void mouseMoved() { //so now we create a function called mouseMoved
- paddleX = mouseX; //sets the value of the X-coordinate of the paddle, to the X position of the mouse cursor
- }
- /*
- recommendations:
- way to write the code along with them:
- 1) void setup
- 2) void draw with only rect function(use 4 numbers instead of paddleX, paddleY)
- 3) explain that you now want to make it move, so you have to use variables as they are changing
- 4) create the 2 floats, insert into rect function
- 5) do void mouseMoved
- 6)show them that for some reason that are trailing shapes
- 7) background function (resseting)
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement