p5.play

edited September 2017 in p5.js Library Questions

I have the function below. All I want to know is how to make the ship below into a p5.play sprite? I have the play library installed. Right now I have the ship but it is not a sprite because I don't know how to do it.

I believe I have to write createSprite(); somewhere?

var ship1;

function draw(){
  ship1 = ship(width/2, height-40);  
}

function ship(x, y) {
  this.x = x;
  this.y = y;
  push();
  translate(this.x-460, y-295);
  noFill();
  strokeWeight(4);
  stroke(67, 104, 48);
  beginShape();
  vertex(400, 300);
  vertex(410, 300);
  vertex(410, 290);
  vertex(445, 290);
  vertex(445, 270);
  vertex(455, 270);
  vertex(455, 260);
  vertex(465, 260);
  vertex(465, 270);
  vertex(475, 270);
  vertex(475, 290);
  vertex(510, 290);
  vertex(510, 300);
  vertex(520, 300);
  vertex(520, 330);
  vertex(400, 330);
  endShape(CLOSE);
  pop();
}
Tagged:

Answers

Sign In or Register to comment.