forked from robertkleffner/mariohtml5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfireFlower.js
More file actions
executable file
·45 lines (38 loc) · 973 Bytes
/
Copy pathfireFlower.js
File metadata and controls
executable file
·45 lines (38 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
Represents a fire powerup.
Code by Rob Kleffner, 2011
*/
Mario.FireFlower = function(world, x, y) {
this.Width = 4;
this.Height = 24;
this.World = world;
this.X = x;
this.Y = y;
this.Image = Enjine.Resources.Images["items"];
this.XPicO = 8;
this.YPicO = 15;
this.XPic = 1;
this.YPic = 0;
this.Height = 12;
this.Facing = 1;
this.PicWidth = this.PicHeight = 16;
this.Life = 0;
};
Mario.FireFlower.prototype = new Mario.NotchSprite();
Mario.FireFlower.prototype.CollideCheck = function() {
var xMarioD = Mario.MarioCharacter.X - this.X, yMarioD = Mario.MarioCharacter.Y - this.Y;
if (xMarioD > -16 && xMarioD < 16) {
if (yMarioD > -this.Height && yMarioD < Mario.MarioCharacter.Height) {
Mario.MarioCharacter.GetFlower();
this.World.RemoveSprite(this);
}
}
};
Mario.FireFlower.prototype.Move = function() {
if (this.Life < 9) {
this.Layer = 0;
this.Y--;
this.Life++;
return;
}
};