erkie / erkie.github.com

Adding asteroids to any site on the web
http://erkie.github.com/
461 stars 92 forks source link

Changing the ship shape #14

Closed variable closed 13 years ago

variable commented 13 years ago

Hello there,

I have managed to change the ship shape to an arrow by editing the playerVerts, however, when the game initializes, the shape is in a wrong angle (pointing to the left), could you please tell me which line I need to edit?

Regards

James

erkie commented 13 years ago

Try changing the "this.dir = new Vector(0, 1);" line.

I think pointing to the left would be "this.dir = new Vector(-1, 0);"

variable commented 13 years ago

var playerVerts = [[-1 * playerWidth/2, 0],[-1_playerWidth/4,0],[-1_playerWidth/4,-1_playerHeight/4_3],[playerWidth/4,-1_playerHeight/4_3],[playerWidth/4,0],[playerWidth/2,0],[0,playerHeight/4*3]];

variable commented 13 years ago

Hi erkie,

I need the arrow to point down, currently is pointing left which is not what I want.

Cheers

James

variable commented 13 years ago

I made this.dir = new Vector(0,0); it points down, but it won't move and the flame is on the wrong side :)

erkie commented 13 years ago

The flame is drawn at a fixed distance from the object. You'll have to look into the drawFlame-method of the ctx-object.

variable commented 13 years ago

I changed to this.dir = new Vector(0,0); the ship is correct position, but the ship won't move and the flame is in wrong angle... What else should I change please?

variable commented 13 years ago

LMAO, I think I know it... I created the verts based on x,y, but it's actually y,x

erkie commented 13 years ago

I think that's a bug (or strange design decision by me), but yeah, sorry about that.