2019-05-02 01:27:20 +00:00
|
|
|
function main() {
|
2019-05-05 21:03:20 +00:00
|
|
|
var playerSpeed = 12;
|
|
|
|
var gravity = 4;
|
|
|
|
var Vx = Vy = 0;
|
|
|
|
|
|
|
|
var animating = false;
|
|
|
|
var animStart = animEnd = 0;
|
|
|
|
var animFrame = animStart;
|
|
|
|
|
2019-05-06 02:04:02 +00:00
|
|
|
Self.SetGravity(true);
|
2019-05-29 04:43:30 +00:00
|
|
|
Self.SetHitbox(7, 4, 17, 28);
|
2019-05-06 02:04:02 +00:00
|
|
|
Self.AddAnimation("walk-left", 100, ["blu-wl1", "blu-wl2", "blu-wl3", "blu-wl4"]);
|
|
|
|
Self.AddAnimation("walk-right", 100, ["blu-wr1", "blu-wr2", "blu-wr3", "blu-wr4"]);
|
2019-05-05 21:03:20 +00:00
|
|
|
|
|
|
|
Events.OnKeypress(function(ev) {
|
|
|
|
Vx = 0;
|
|
|
|
Vy = 0;
|
|
|
|
|
|
|
|
if (ev.Right.Now) {
|
2019-05-06 02:04:02 +00:00
|
|
|
if (!Self.IsAnimating()) {
|
|
|
|
Self.PlayAnimation("walk-right", null);
|
|
|
|
}
|
2019-05-05 21:03:20 +00:00
|
|
|
Vx = playerSpeed;
|
|
|
|
} else if (ev.Left.Now) {
|
2019-05-06 02:04:02 +00:00
|
|
|
if (!Self.IsAnimating()) {
|
|
|
|
Self.PlayAnimation("walk-left", null);
|
|
|
|
}
|
2019-05-05 21:03:20 +00:00
|
|
|
Vx = -playerSpeed;
|
|
|
|
} else {
|
2019-05-06 02:04:02 +00:00
|
|
|
Self.StopAnimation();
|
2019-05-05 21:03:20 +00:00
|
|
|
animating = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Self.SetVelocity(Point(Vx, Vy));
|
|
|
|
})
|
2019-05-02 01:27:20 +00:00
|
|
|
}
|