Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Player {
- float xpos;
- int ypos;
- color paddlecolor = color(50);
- Player(int screen_y)
- {
- xpos=SCREENX/2;
- ypos=screen_y;
- }
- void move(int x)
- {
- if (x>SCREENX-PADDLEWIDTH) xpos = SCREENX - PADDLEWIDTH;
- else xpos = x;
- }
- void moveComputer(int x)
- {
- if (x>SCREENX)
- {
- xpos = SCREENX;
- } else
- {
- xpos = round(x);
- }
- }
- void draw()
- {
- {
- fill(paddlecolor);
- rect(xpos, ypos, PADDLEWIDTH, PADDLEHEIGHT);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement