Add Player Character Sprites
* Added initial walking sprites for the player character, "Boy." * Player doodad filename and title screen level are now configurable in the balance/numbers.go package.
37
dev-assets/doodads/boy/boy.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
function main() {
|
||||
var playerSpeed = 12;
|
||||
var gravity = 4;
|
||||
var Vx = Vy = 0;
|
||||
|
||||
var animating = false;
|
||||
var animStart = animEnd = 0;
|
||||
var animFrame = animStart;
|
||||
|
||||
Self.SetMobile(true);
|
||||
Self.SetGravity(true);
|
||||
Self.SetHitbox(0, 0, 29, 52);
|
||||
Self.AddAnimation("walk-left", 200, ["stand-left", "walk-left-1", "walk-left-2", "walk-left-3", "walk-left-2", "walk-left-1"]);
|
||||
Self.AddAnimation("walk-right", 200, ["stand-right", "walk-right-1", "walk-right-2", "walk-right-3", "walk-right-2", "walk-right-1"]);
|
||||
|
||||
Events.OnKeypress(function(ev) {
|
||||
Vx = 0;
|
||||
Vy = 0;
|
||||
|
||||
if (ev.Right) {
|
||||
if (!Self.IsAnimating()) {
|
||||
Self.PlayAnimation("walk-right", null);
|
||||
}
|
||||
Vx = playerSpeed;
|
||||
} else if (ev.Left) {
|
||||
if (!Self.IsAnimating()) {
|
||||
Self.PlayAnimation("walk-left", null);
|
||||
}
|
||||
Vx = -playerSpeed;
|
||||
} else {
|
||||
Self.StopAnimation();
|
||||
animating = false;
|
||||
}
|
||||
|
||||
// Self.SetVelocity(Point(Vx, Vy));
|
||||
})
|
||||
}
|
BIN
dev-assets/doodads/boy/stand-left.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
dev-assets/doodads/boy/stand-right.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
dev-assets/doodads/boy/walk-left-1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
dev-assets/doodads/boy/walk-left-2.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
dev-assets/doodads/boy/walk-left-3.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
dev-assets/doodads/boy/walk-right-1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
dev-assets/doodads/boy/walk-right-2.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
dev-assets/doodads/boy/walk-right-3.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
dev-assets/doodads/boy/walk-right.gif
Normal file
After Width: | Height: | Size: 3.3 KiB |
|
@ -8,6 +8,19 @@ fi
|
|||
|
||||
mkdir -p ../../assets/doodads
|
||||
|
||||
boy() {
|
||||
cd boy/
|
||||
|
||||
doodad convert -t "Boy" stand-right.png stand-left.png \
|
||||
walk-right-1.png walk-right-2.png walk-right-3.png \
|
||||
walk-left-1.png walk-left-2.png walk-left-3.png \
|
||||
boy.doodad
|
||||
doodad install-script boy.js boy.doodad
|
||||
|
||||
cp *.doodad ../../../assets/doodads/
|
||||
cd ..
|
||||
}
|
||||
|
||||
buttons() {
|
||||
cd buttons/
|
||||
|
||||
|
@ -123,6 +136,7 @@ onoff() {
|
|||
cd ..
|
||||
}
|
||||
|
||||
boy
|
||||
buttons
|
||||
switches
|
||||
doors
|
||||
|
@ -132,3 +146,4 @@ objects
|
|||
onoff
|
||||
doodad edit-doodad -quiet -lock -author "Noah" ../../assets/doodads/*.doodad
|
||||
doodad edit-doodad -hide ../../assets/doodads/azu-blu.doodad
|
||||
doodad edit-doodad -hide ../../assets/doodads/boy.doodad
|
||||
|
|