Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Border
- {
- constructor(width, height, num1, num2, speed)
- {
- this.height = height;
- this.width = width;
- this.x = 0;
- this.myrand = random(num1,num2);
- }
- reveal()
- {
- rect(this.x,this.myrand,this.height,this.width);
- }
- along(speed)
- {
- speed = speed;
- this.x += speed;
- if(this.x >= 600)
- {
- this.x = 0;
- }
- }
- RandomSpawnRange(num1, num2)
- {
- if(this.x >= 590)
- {
- this.myrand = random(num1, num2);
- }
- }
- }
- class Player
- {
- constructor(x,y,diam)
- {
- this.x = x;
- this.y = y;
- this.diam = diam;
- }
- reveal()
- {
- ellipse(this.x, this.y, this.diam);
- }
- lol()
- {
- this.x = 5000;
- }
- along(position)
- {
- this.y = mouseY;
- this.x = mouseX;
- noCursor();
- }
- }
- function setup() {
- createCanvas(600, 600);
- x = new Border(100,20, 0, 500);
- y = new Player(550,50,50);
- }
- function draw() {
- background(1);
- x.reveal();
- x.along(5)
- x.RandomSpawnRange(0,500,10);
- y.reveal();
- y.along();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement