From 93a74f493825b4a4c76774f190b2fc39b2488d8f Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Sun, 30 Apr 2006 21:32:58 +0000 Subject: [PATCH] Experimented with loading hitbox from .sprite file SVN-Revision: 3475 --- .../bouncing_snowball/bouncing_snowball.sprite | 9 ++-- data/images/creatures/dart/dart.sprite | 6 +-- data/images/creatures/dispenser/dispenser.sprite | 15 ++---- data/images/creatures/dummyguy/dummyguy.sprite | 18 +++----- data/images/creatures/fish/fish.sprite | 12 ++--- data/images/creatures/flame_fish/flame_fish.sprite | 6 +-- .../flying_snowball/flying_snowball.sprite | 12 ++--- data/images/creatures/jumpy/jumpy.sprite | 24 ++++------ data/images/creatures/kugelblitz/kugelblitz.sprite | 9 ++-- data/images/creatures/mr_bomb/bomb.sprite | 9 ++-- data/images/creatures/mr_bomb/mr_bomb.sprite | 12 ++--- .../creatures/mr_iceblock/mr_iceblock.sprite | 18 +++----- data/images/creatures/mr_rocket/explosion.sprite | 6 +-- data/images/creatures/mr_rocket/mr_rocket.sprite | 18 +++----- data/images/creatures/mr_tree/mr_tree.sprite | 16 +++---- data/images/creatures/nolok/nolok.sprite | 18 +++----- data/images/creatures/plant/plant.sprite | 24 ++++------ data/images/creatures/poison_ivy/poison_ivy.sprite | 12 ++--- data/images/creatures/skullyhop/skullyhop.sprite | 24 ++++------ data/images/creatures/snail/snail.sprite | 18 +++----- data/images/creatures/snowball/snowball.sprite | 12 ++--- data/images/creatures/spidermite/spidermite.sprite | 12 ++--- data/images/creatures/spiky/sleepingspiky.sprite | 24 ++++------ data/images/creatures/spiky/spiky.sprite | 12 ++--- data/images/creatures/stalactite/stalactite.sprite | 6 +-- .../creatures/tux_big/big-fire-tux-head.sprite | 48 +++++++------------ data/images/creatures/tux_big/big-tux-arms.sprite | 54 ++++++++-------------- data/images/creatures/tux_big/big-tux-body.sprite | 42 ++++++----------- data/images/creatures/tux_big/big-tux-feet.sprite | 42 ++++++----------- data/images/creatures/tux_big/big-tux-head.sprite | 48 +++++++------------ data/images/creatures/tux_big/bigtux-star.sprite | 3 +- .../creatures/tux_small/small-tux-arms.sprite | 36 +++++---------- .../creatures/tux_small/small-tux-body.sprite | 30 ++++-------- .../creatures/tux_small/smalltux-gameover.sprite | 3 +- .../creatures/tux_small/smalltux-star.sprite | 3 +- data/images/creatures/yeti/yeti.sprite | 27 ++++------- data/images/creatures/zeekling/zeekling.sprite | 18 +++----- data/images/objects/bullets/firebullet.sprite | 3 +- data/images/objects/bullets/icebullet.sprite | 3 +- data/images/objects/castledoor/castledoor.sprite | 3 +- data/images/objects/castledoor/keyholes.sprite | 3 +- data/images/objects/castledoor/torchflame.sprite | 3 +- data/images/objects/door/door.sprite | 6 +-- data/images/objects/firefly/firefly.sprite | 3 +- data/images/objects/hatch/hatch.sprite | 6 +-- data/images/objects/icecube/icecube.sprite | 3 +- data/images/objects/particles/stomp.sprite | 3 +- data/images/objects/radio/radio.sprite | 6 +-- data/images/objects/trampoline/trampoline.sprite | 3 +- data/images/worldmap/common/leveldot.sprite | 6 +-- data/images/worldmap/common/n_stone.sprite | 6 +-- data/images/worldmap/common/shroom.sprite | 6 +-- data/images/worldmap/common/teleporterdot.sprite | 3 +- data/images/worldmap/common/torch.sprite | 6 +-- data/images/worldmap/common/torch1.sprite | 6 +-- data/images/worldmap/common/tux.sprite | 14 +++--- data/images/worldmap/common/yeti.sprite | 6 +-- src/badguy/mrtree.cpp | 25 +++++++--- src/sprite/sprite.cpp | 24 ++++++++++ src/sprite/sprite.hpp | 9 ++++ src/sprite/sprite_data.cpp | 27 +++++++++-- src/sprite/sprite_data.hpp | 14 ++++-- 62 files changed, 355 insertions(+), 548 deletions(-) diff --git a/data/images/creatures/bouncing_snowball/bouncing_snowball.sprite b/data/images/creatures/bouncing_snowball/bouncing_snowball.sprite index 0233b5546..9adbbc8cd 100644 --- a/data/images/creatures/bouncing_snowball/bouncing_snowball.sprite +++ b/data/images/creatures/bouncing_snowball/bouncing_snowball.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "left") - (x-offset 1) - (y-offset 0) + (hitbox 1 0 0 0) (images "left-0.png" "left-1.png" "left-2.png" @@ -12,13 +11,11 @@ (action (name "right") - (x-offset 1) - (y-offset 0) + (hitbox 1 0 0 0) (mirror-action "left")) (action (name "squished") - (x-offset 1) - (y-offset -19) + (hitbox 1 --19 0 0) (images "../snowball/squished-left.png")) ) diff --git a/data/images/creatures/dart/dart.sprite b/data/images/creatures/dart/dart.sprite index 461a530a1..be1fe4967 100644 --- a/data/images/creatures/dart/dart.sprite +++ b/data/images/creatures/dart/dart.sprite @@ -1,14 +1,12 @@ (supertux-sprite (action (name "flying-left") - (x-offset 3) - (y-offset 3) + (hitbox 3 3 0 0) (images "flying.png") ) (action (name "flying-right") - (x-offset 3) - (y-offset 3) + (hitbox 3 3 0 0) (mirror-action "flying-left") ) ) diff --git a/data/images/creatures/dispenser/dispenser.sprite b/data/images/creatures/dispenser/dispenser.sprite index d955a6f71..358eca5a9 100644 --- a/data/images/creatures/dispenser/dispenser.sprite +++ b/data/images/creatures/dispenser/dispenser.sprite @@ -1,32 +1,27 @@ (supertux-sprite (action (name "dropper") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "dropper.png")) (action (name "working-left") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "working.png")) (action (name "broken-left") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "broken.png")) (action (name "working-right") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (mirror-action "working-left")) (action (name "broken-right") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (mirror-action "broken-left")) ) diff --git a/data/images/creatures/dummyguy/dummyguy.sprite b/data/images/creatures/dummyguy/dummyguy.sprite index ec4014735..f2200731d 100644 --- a/data/images/creatures/dummyguy/dummyguy.sprite +++ b/data/images/creatures/dummyguy/dummyguy.sprite @@ -2,42 +2,36 @@ (action (name "left") (fps 6) - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "walk-1.png" "walk-2.png") ) (action (name "right") (fps 6) - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (mirror-action "left") ) (action (name "stand") - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "stand.png")) (action (name "throw") (fps 6) - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "throw.png")) (action (name "jump") - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "jump.png")) (action (name "dead") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "dead.png") ) ) diff --git a/data/images/creatures/fish/fish.sprite b/data/images/creatures/fish/fish.sprite index 4b2684a32..ea9d3ab9c 100644 --- a/data/images/creatures/fish/fish.sprite +++ b/data/images/creatures/fish/fish.sprite @@ -1,27 +1,23 @@ (supertux-sprite (action (name "normal") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "left-0.png" "left-1.png")) (action (name "down") - (x-offset 2) - (y-offset 11) + (hitbox 2 11 0 0) (images "down.png")) (action (name "iced") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "iced-left.png")) (action (name "iced-down") - (x-offset 2) - (y-offset 11) + (hitbox 2 11 0 0) (images "iced-down.png")) ) diff --git a/data/images/creatures/flame_fish/flame_fish.sprite b/data/images/creatures/flame_fish/flame_fish.sprite index fdacd299d..69ff2ab9d 100644 --- a/data/images/creatures/flame_fish/flame_fish.sprite +++ b/data/images/creatures/flame_fish/flame_fish.sprite @@ -1,15 +1,13 @@ (sprite (action (name "normal") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "left-0.png" "left-1.png")) (action (name "down") - (x-offset 2) - (y-offset 11) + (hitbox 2 11 0 0) (images "down.png")) ) diff --git a/data/images/creatures/flying_snowball/flying_snowball.sprite b/data/images/creatures/flying_snowball/flying_snowball.sprite index b92efbf22..390ac5a5c 100644 --- a/data/images/creatures/flying_snowball/flying_snowball.sprite +++ b/data/images/creatures/flying_snowball/flying_snowball.sprite @@ -1,26 +1,22 @@ (supertux-sprite (action (name "left") - (x-offset 4) - (y-offset 3) + (hitbox 4 3 0 0) (images "left-0.png" "left-1.png")) (action (name "right") - (x-offset 4) - (y-offset 3) + (hitbox 4 3 0 0) (mirror-action "left")) (action (name "squished-left") - (x-offset 4) - (y-offset -12) + (hitbox 4 --12 0 0) (images "squished-left.png")) (action (name "squished-right") - (x-offset 4) - (y-offset -12) + (hitbox 4 --12 0 0) (mirror-action "squished-left")) ) diff --git a/data/images/creatures/jumpy/jumpy.sprite b/data/images/creatures/jumpy/jumpy.sprite index 507f015f0..8b881fd9b 100644 --- a/data/images/creatures/jumpy/jumpy.sprite +++ b/data/images/creatures/jumpy/jumpy.sprite @@ -2,50 +2,42 @@ (action (name "left-up") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (images "left-up.png")) (action (name "right-up") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (mirror-action "left-up")) (action (name "left-down") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (images "left-down.png")) (action (name "right-down") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (mirror-action "left-down")) (action (name "left-middle") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (images "left-middle.png")) (action (name "right-middle") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (mirror-action "left-middle")) (action (name "left-iced") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (images "iced-left-up.png")) (action (name "right-iced") - (x-offset 7) - (y-offset 8) + (hitbox 7 8 0 0) (mirror-action "left-iced")) ) diff --git a/data/images/creatures/kugelblitz/kugelblitz.sprite b/data/images/creatures/kugelblitz/kugelblitz.sprite index 5d894ec92..6f8d560be 100644 --- a/data/images/creatures/kugelblitz/kugelblitz.sprite +++ b/data/images/creatures/kugelblitz/kugelblitz.sprite @@ -1,24 +1,21 @@ (supertux-sprite (action (name "falling") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "falling-0.png" "falling-1.png" "falling-2.png")) (action (name "flying") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "flying-0.png" "flying-1.png" "flying-2.png")) (action (name "pop") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (fps 20) (images "pop-0.png" "pop-1.png" diff --git a/data/images/creatures/mr_bomb/bomb.sprite b/data/images/creatures/mr_bomb/bomb.sprite index 946564bf4..18c98ab3b 100644 --- a/data/images/creatures/mr_bomb/bomb.sprite +++ b/data/images/creatures/mr_bomb/bomb.sprite @@ -3,23 +3,20 @@ (action (name "ticking-left") (fps 15.0) - (x-offset 3) - (y-offset 8) + (hitbox 3 8 0 0) (images "exploding-left-0.png" "exploding-left-1.png")) (action (name "ticking-right") (fps 15.0) - (x-offset 10) - (y-offset 8) + (hitbox 10 8 0 0) (mirror-action "ticking-left")) (action (name "explosion") (fps 15.0) - (x-offset 32) - (y-offset 32) + (hitbox 32 32 0 0) (images "explosion-0.png" "explosion-1.png")) ) diff --git a/data/images/creatures/mr_bomb/mr_bomb.sprite b/data/images/creatures/mr_bomb/mr_bomb.sprite index 9d2251a3d..a590af20c 100644 --- a/data/images/creatures/mr_bomb/mr_bomb.sprite +++ b/data/images/creatures/mr_bomb/mr_bomb.sprite @@ -2,8 +2,7 @@ (action (name "left") (fps 10.0) - (x-offset 3) - (y-offset 12) + (hitbox 3 12 0 0) (images "left-0.png" "left-1.png" "left-2.png" @@ -12,20 +11,17 @@ (action (name "right") (fps 10.0) - (x-offset 7) - (y-offset 12) + (hitbox 7 12 0 0) (mirror-action "left")) (action (name "iced-left") - (x-offset 3) - (y-offset 12) + (hitbox 3 12 0 0) (images "iced-left.png")) (action (name "iced-right") - (x-offset 7) - (y-offset 12) + (hitbox 7 12 0 0) (mirror-action "iced-left")) ) diff --git a/data/images/creatures/mr_iceblock/mr_iceblock.sprite b/data/images/creatures/mr_iceblock/mr_iceblock.sprite index 69e659fee..37e04518c 100644 --- a/data/images/creatures/mr_iceblock/mr_iceblock.sprite +++ b/data/images/creatures/mr_iceblock/mr_iceblock.sprite @@ -1,34 +1,28 @@ (supertux-sprite (action (name "left") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "left-0.png" "left-1.png" "left-2.png" "left-1.png")) (action (name "right") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (mirror-action "left")) (action (name "falling-left") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "flat-left.png")) (action (name "falling-right") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (mirror-action "falling-left")) (action (name "flat-left") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "flat-left.png")) (action (name "flat-right") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (mirror-action "falling-left"))) diff --git a/data/images/creatures/mr_rocket/explosion.sprite b/data/images/creatures/mr_rocket/explosion.sprite index 3b41d7fed..d7004d1c2 100644 --- a/data/images/creatures/mr_rocket/explosion.sprite +++ b/data/images/creatures/mr_rocket/explosion.sprite @@ -2,16 +2,14 @@ (action (name "explosion-left") (fps 15.0) - (x-offset 0) - (y-offset 32) + (hitbox 0 32 0 0) (images "explosion-0.png" "explosion-1.png") ) (action (name "explosion-right") (fps 15.0) - (x-offset 0) - (y-offset 32) + (hitbox 0 32 0 0) (mirror-action "explosion-left") ) ) diff --git a/data/images/creatures/mr_rocket/mr_rocket.sprite b/data/images/creatures/mr_rocket/mr_rocket.sprite index 00ea9b1ff..b44050479 100644 --- a/data/images/creatures/mr_rocket/mr_rocket.sprite +++ b/data/images/creatures/mr_rocket/mr_rocket.sprite @@ -2,8 +2,7 @@ (action (name "left") (fps 15.0) - (x-offset 3) - (y-offset 12) + (hitbox 3 12 0 0) (images "flying-0.png" "flying-1.png" "flying-2.png" @@ -13,34 +12,29 @@ (action (name "right") (fps 10.0) - (x-offset 7) - (y-offset 12) + (hitbox 7 12 0 0) (mirror-action "left") ) (action (name "squished-left") - (x-offset 7) - (y-offset 0) + (hitbox 7 0 0 0) (images "squished.png") ) (action (name "squished-right") - (x-offset 7) - (y-offset 0) + (hitbox 7 0 0 0) (mirror-action "squished-left")) (action (name "collision-left") - (x-offset 3) - (y-offset 12) + (hitbox 3 12 0 0) (images "collision.png")) (action (name "collision-right") - (x-offset 3) - (y-offset 12) + (hitbox 3 12 0 0) (mirror-action "squished-left") ) ) diff --git a/data/images/creatures/mr_tree/mr_tree.sprite b/data/images/creatures/mr_tree/mr_tree.sprite index e6359bb9c..cfdf7d19c 100644 --- a/data/images/creatures/mr_tree/mr_tree.sprite +++ b/data/images/creatures/mr_tree/mr_tree.sprite @@ -1,6 +1,6 @@ (supertux-sprite (action - (y-offset -2) + (hitbox 0 -2 84.8 84.8) (name "large-left") (images "walk-left-1.png" "walk-left-2.png" @@ -11,13 +11,12 @@ ) ) (action - (y-offset -2) + (hitbox 0 -2 84.8 84.8) (name "large-right") (mirror-action "large-left") ) (action - (x-offset 20) - (y-offset 23) + (hitbox 20 23 42 62) (name "small-left") (images "small-left-1.png" "small-left-2.png" @@ -29,20 +28,17 @@ ) ) (action - (x-offset 20) - (y-offset 23) + (hitbox 20 23 42 62) (name "small-right") (mirror-action "small-left") ) (action - (x-offset 20) - (y-offset 23) + (hitbox 20 23 42 42) (name "squished-left") (images "squished-left.png") ) (action - (x-offset 20) - (y-offset 23) + (hitbox 20 23 42 42) (name "squished-right") (mirror-action "squished-left") ) diff --git a/data/images/creatures/nolok/nolok.sprite b/data/images/creatures/nolok/nolok.sprite index f9be99064..dab1801dd 100644 --- a/data/images/creatures/nolok/nolok.sprite +++ b/data/images/creatures/nolok/nolok.sprite @@ -2,8 +2,7 @@ (action (name "left") (fps 6) - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "walk-0.png" "walk-1.png" "walk-2.png" @@ -15,31 +14,27 @@ (action (name "right") (fps 6) - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (mirror-action "left") ) (action (name "stand") - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "walk-0.png") ) (action (name "throw") (fps 6) - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "jump-0.png" ) ) (action (name "jump") - (x-offset 0) - (y-offset 40) + (hitbox 0 40 0 0) (images "jump-0.png" "jump-1.png" ) @@ -47,8 +42,7 @@ (action (name "dead") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "throw-0.png") ) ) diff --git a/data/images/creatures/plant/plant.sprite b/data/images/creatures/plant/plant.sprite index 159a0a126..36b54aaf9 100644 --- a/data/images/creatures/plant/plant.sprite +++ b/data/images/creatures/plant/plant.sprite @@ -1,41 +1,34 @@ (supertux-sprite (action (name "left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "left-0.png" "left-1.png" "left-2.png")) (action (name "right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "left")) (action (name "iced-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "iced-left.png")) (action (name "iced-right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "iced-left") ) (action (name "sleeping-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "sleeping-left.png")) (action (name "sleeping-right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "sleeping-left")) (action (name "waking-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (fps 6.0) (images "waking-left-0.png" "waking-left-1.png" @@ -43,7 +36,6 @@ (action (name "waking-right") (fps 6.0) - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "waking-left")) ) diff --git a/data/images/creatures/poison_ivy/poison_ivy.sprite b/data/images/creatures/poison_ivy/poison_ivy.sprite index 12247aa87..9a46d1dea 100644 --- a/data/images/creatures/poison_ivy/poison_ivy.sprite +++ b/data/images/creatures/poison_ivy/poison_ivy.sprite @@ -1,27 +1,23 @@ (supertux-sprite (action (name "left") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (images "left-0.png" "left-1.png" "left-2.png")) (action (name "right") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (mirror-action "left")) (action (name "squished-left") - (x-offset 0) - (y-offset 3) + (hitbox 0 3 0 0) (images "squished.png")) (action (name "squished-right") - (x-offset 0) - (y-offset 3) + (hitbox 0 3 0 0) (mirror-action "squished-left") ) ) diff --git a/data/images/creatures/skullyhop/skullyhop.sprite b/data/images/creatures/skullyhop/skullyhop.sprite index 78e4212db..27bc4da41 100644 --- a/data/images/creatures/skullyhop/skullyhop.sprite +++ b/data/images/creatures/skullyhop/skullyhop.sprite @@ -1,44 +1,36 @@ (supertux-sprite (action (name "standing-left") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "standing-0.png")) (action (name "standing-right") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (mirror-action "standing-left")) (action (name "charging-left") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (fps 10.0) (images "charging-0.png" "charging-1.png")) (action (name "charging-right") (fps 10.0) - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (mirror-action "charging-left")) (action (name "jumping-left") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "jumping-0.png")) (action (name "jumping-right") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (mirror-action "jumping-left")) (action (name "squished-left") - (x-offset 0) - (y-offset -14) + (hitbox 0 --14 0 0) (images "squished-0.png")) (action (name "squished-right") - (x-offset 0) - (y-offset -14) + (hitbox 0 --14 0 0) (mirror-action "squished-left"))) diff --git a/data/images/creatures/snail/snail.sprite b/data/images/creatures/snail/snail.sprite index 83aff2003..b03b31e0e 100644 --- a/data/images/creatures/snail/snail.sprite +++ b/data/images/creatures/snail/snail.sprite @@ -1,21 +1,18 @@ (supertux-sprite (action (name "left") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "snowsnail1.png" "snowsnail2.png" "snowsnail3.png" )) (action (name "right") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (mirror-action "left")) (action (name "falling-left") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "snowsnail_flip1.png" "snowsnail_flip2.png" "snowsnail_flip3.png" @@ -26,13 +23,11 @@ )) (action (name "falling-right") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (mirror-action "falling-left")) (action (name "flat-left") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (images "snowsnail_flip1.png" "snowsnail_flip2.png" "snowsnail_flip3.png" @@ -43,6 +38,5 @@ )) (action (name "flat-right") - (x-offset 2) - (y-offset 3) + (hitbox 2 3 0 0) (mirror-action "falling-left"))) diff --git a/data/images/creatures/snowball/snowball.sprite b/data/images/creatures/snowball/snowball.sprite index f6249e032..a3081cc74 100644 --- a/data/images/creatures/snowball/snowball.sprite +++ b/data/images/creatures/snowball/snowball.sprite @@ -1,28 +1,24 @@ (supertux-sprite (action (name "left") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (images "left-0.png" "left-1.png" "left-2.png") ) (action (name "right") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (mirror-action "left") ) (action (name "squished-left") - (x-offset 1) - (y-offset -19) + (hitbox 1 --19 0 0) (images "squished-left.png") ) (action (name "squished-right") - (x-offset 1) - (y-offset -19) + (hitbox 1 --19 0 0) (mirror-action "squished-left") ) ) diff --git a/data/images/creatures/spidermite/spidermite.sprite b/data/images/creatures/spidermite/spidermite.sprite index 4d02d44f4..d57404825 100644 --- a/data/images/creatures/spidermite/spidermite.sprite +++ b/data/images/creatures/spidermite/spidermite.sprite @@ -1,25 +1,21 @@ (supertux-sprite (action (name "left") - (x-offset 4) - (y-offset 3) + (hitbox 4 3 0 0) (images "spidermite.png" "spidermite0.png" "spidermite1.png" "spidermite0.png")) (action (name "right") - (x-offset 4) - (y-offset 3) + (hitbox 4 3 0 0) (mirror-action "left")) (action (name "squished-left") - (x-offset 4) - (y-offset -12) + (hitbox 4 --12 0 0) (images "spidermite-squish.png")) (action (name "squished-right") - (x-offset 4) - (y-offset -12) + (hitbox 4 --12 0 0) (mirror-action "squished-left"))) diff --git a/data/images/creatures/spiky/sleepingspiky.sprite b/data/images/creatures/spiky/sleepingspiky.sprite index 159a0a126..36b54aaf9 100644 --- a/data/images/creatures/spiky/sleepingspiky.sprite +++ b/data/images/creatures/spiky/sleepingspiky.sprite @@ -1,41 +1,34 @@ (supertux-sprite (action (name "left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "left-0.png" "left-1.png" "left-2.png")) (action (name "right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "left")) (action (name "iced-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "iced-left.png")) (action (name "iced-right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "iced-left") ) (action (name "sleeping-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "sleeping-left.png")) (action (name "sleeping-right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "sleeping-left")) (action (name "waking-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (fps 6.0) (images "waking-left-0.png" "waking-left-1.png" @@ -43,7 +36,6 @@ (action (name "waking-right") (fps 6.0) - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "waking-left")) ) diff --git a/data/images/creatures/spiky/spiky.sprite b/data/images/creatures/spiky/spiky.sprite index 07b114fc9..6b2bafcd9 100644 --- a/data/images/creatures/spiky/spiky.sprite +++ b/data/images/creatures/spiky/spiky.sprite @@ -1,25 +1,21 @@ (supertux-sprite (action (name "left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "left-0.png" "left-1.png" "left-2.png")) (action (name "right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "left")) (action (name "iced-left") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (images "iced-left.png")) (action (name "iced-right") - (x-offset 6) - (y-offset 10) + (hitbox 6 10 0 0) (mirror-action "iced-left") ) ) diff --git a/data/images/creatures/stalactite/stalactite.sprite b/data/images/creatures/stalactite/stalactite.sprite index cc3034efb..ec258ade3 100644 --- a/data/images/creatures/stalactite/stalactite.sprite +++ b/data/images/creatures/stalactite/stalactite.sprite @@ -1,11 +1,9 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "falling.png")) (action (name "squished") - (x-offset 0) - (y-offset 16) + (hitbox 0 16 0 0) (images "broken.png"))) diff --git a/data/images/creatures/tux_big/big-fire-tux-head.sprite b/data/images/creatures/tux_big/big-fire-tux-head.sprite index d30bd3527..47c671027 100644 --- a/data/images/creatures/tux_big/big-fire-tux-head.sprite +++ b/data/images/creatures/tux_big/big-fire-tux-head.sprite @@ -2,106 +2,90 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-fire-stand-0.png")) (action (name "walk-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-fire-stand-0.png")) (action (name "stand-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 30) + (hitbox 5 30 0 0) (images "head-fire-stand-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 27) - (y-offset 30) + (hitbox 27 30 0 0) (mirror-action "jump-right")) (action (name "duck-right") (fps 15.0) - (x-offset 5) - (y-offset 62) + (hitbox 5 62 0 0) (images "head-fire-duck-0.png")) (action (name "duck-left") (fps 15.0) - (x-offset 27) - (y-offset 62) + (hitbox 27 62 0 0) (mirror-action "duck-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "head-fire-skid-0.png")) (action (name "skid-left") - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-fire-stand-0.png")) (action (name "kick-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "kick-right")) (action (name "buttjump-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-fire-stand-0.png")) (action (name "buttjump-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "buttjump-right")) (action (name "idle-right") (fps 1.0) - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "head-idle-blink-0.png" "head-idle-blink-1.png")) (action (name "idle-left") (fps 1.0) - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "idle-right"))) diff --git a/data/images/creatures/tux_big/big-tux-arms.sprite b/data/images/creatures/tux_big/big-tux-arms.sprite index a79f2a046..d31242552 100644 --- a/data/images/creatures/tux_big/big-tux-arms.sprite +++ b/data/images/creatures/tux_big/big-tux-arms.sprite @@ -2,8 +2,7 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "arms-walk-0.png" "arms-walk-1.png" "arms-walk-2.png" @@ -14,112 +13,95 @@ (action (name "walk-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "arms-stand-0.png")) (action (name "stand-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 30) + (hitbox 5 30 0 0) (images "arms-jump-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 27) - (y-offset 30) + (hitbox 27 30 0 0) (mirror-action "jump-right")) (action (name "duck-right") - (x-offset 5) - (y-offset 62) + (hitbox 5 62 0 0) (images "arms-duck-0.png")) (action (name "duck-left") - (x-offset 27) - (y-offset 62) + (hitbox 27 62 0 0) (mirror-action "duck-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "arms-skid-0.png")) (action (name "skid-left") (fps 15.0) - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "arms-stand-0.png")) (action (name "kick-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "kick-right")) (action (name "buttjump-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "arms-stand-0.png")) (action (name "buttjump-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "buttjump-right")) ; Grabbing is arms specific! (action (name "grab-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (z-order 2) (images "arms-grab-0.png")) (action (name "grab-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (z-order 2) (mirror-action "grab-right")) (action (name "duck+grab-right") - (x-offset 5) - (y-offset 62) + (hitbox 5 62 0 0) (z-order 2) (images "arms-duck+grab-0.png")) (action (name "duck+grab-left") - (x-offset 27) - (y-offset 62) + (hitbox 27 62 0 0) (z-order 2) (mirror-action "duck+grab-right"))) diff --git a/data/images/creatures/tux_big/big-tux-body.sprite b/data/images/creatures/tux_big/big-tux-body.sprite index ea9b4126c..8d8cd09c6 100644 --- a/data/images/creatures/tux_big/big-tux-body.sprite +++ b/data/images/creatures/tux_big/big-tux-body.sprite @@ -2,94 +2,80 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "body-stand-0.png")) (action (name "walk-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "body-stand-0.png")) (action (name "stand-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 30) + (hitbox 5 30 0 0) (images "body-stand-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 27) - (y-offset 30) + (hitbox 27 30 0 0) (mirror-action "jump-right")) (action (name "duck-right") (fps 15.0) - (x-offset 5) - (y-offset 62) + (hitbox 5 62 0 0) (images "body-duck-0.png")) (action (name "duck-left") (fps 15.0) - (x-offset 27) - (y-offset 62) + (hitbox 27 62 0 0) (mirror-action "duck-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "body-skid-0.png")) (action (name "skid-left") (fps 15.0) - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "body-stand-0.png")) (action (name "kick-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "kick-right")) (action (name "buttjump-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "body-stand-0.png")) (action (name "buttjump-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "buttjump-right"))) diff --git a/data/images/creatures/tux_big/big-tux-feet.sprite b/data/images/creatures/tux_big/big-tux-feet.sprite index ace4e1a5c..6c2e94ff6 100644 --- a/data/images/creatures/tux_big/big-tux-feet.sprite +++ b/data/images/creatures/tux_big/big-tux-feet.sprite @@ -2,8 +2,7 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "feet-walk-0.png" "feet-walk-1.png" "feet-walk-2.png" @@ -14,84 +13,71 @@ (action (name "walk-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "feet-stand-0.png")) (action (name "stand-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 30) + (hitbox 5 30 0 0) (images "feet-jump-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 27) - (y-offset 30) + (hitbox 27 30 0 0) (mirror-action "jump-right")) (action (name "duck-right") (fps 15.0) - (x-offset 5) - (y-offset 62) + (hitbox 5 62 0 0) (images "feet-duck-0.png")) (action (name "duck-left") (fps 15.0) - (x-offset 27) - (y-offset 62) + (hitbox 27 62 0 0) (mirror-action "duck-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "feet-skid-0.png")) (action (name "skid-left") - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "feet-kick-0.png")) (action (name "kick-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "kick-right")) (action (name "buttjump-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "feet-buttjump-0.png")) (action (name "buttjump-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "buttjump-right"))) diff --git a/data/images/creatures/tux_big/big-tux-head.sprite b/data/images/creatures/tux_big/big-tux-head.sprite index 5cc7f37a8..cbb0eb385 100644 --- a/data/images/creatures/tux_big/big-tux-head.sprite +++ b/data/images/creatures/tux_big/big-tux-head.sprite @@ -2,102 +2,87 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-stand-0.png")) (action (name "walk-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-stand-0.png")) (action (name "stand-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 30) + (hitbox 5 30 0 0) (images "head-stand-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 27) - (y-offset 30) + (hitbox 27 30 0 0) (mirror-action "jump-right")) (action (name "duck-right") (fps 15.0) - (x-offset 5) - (y-offset 62) + (hitbox 5 62 0 0) (images "head-duck-0.png")) (action (name "duck-left") (fps 15.0) - (x-offset 27) - (y-offset 62) + (hitbox 27 62 0 0) (mirror-action "duck-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "head-skid-0.png")) (action (name "skid-left") (fps 15.0) - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-stand-0.png")) (action (name "kick-left") (fps 15.0) - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "kick-right")) (action (name "buttjump-right") - (x-offset 5) - (y-offset 32) + (hitbox 5 32 0 0) (images "head-stand-0.png")) (action (name "buttjump-left") - (x-offset 27) - (y-offset 32) + (hitbox 27 32 0 0) (mirror-action "buttjump-right")) (action (name "idle-right") (fps 1.0) - (x-offset 6) - (y-offset 31) + (hitbox 6 31 0 0) (images "head-idle-blink-0.png" "head-idle-blink-1.png")) @@ -105,6 +90,5 @@ (action (name "idle-left") (fps 1.0) - (x-offset 27) - (y-offset 31) + (hitbox 27 31 0 0) (mirror-action "idle-right"))) diff --git a/data/images/creatures/tux_big/bigtux-star.sprite b/data/images/creatures/tux_big/bigtux-star.sprite index 791ea566e..c5feeaa46 100644 --- a/data/images/creatures/tux_big/bigtux-star.sprite +++ b/data/images/creatures/tux_big/bigtux-star.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action - (x-offset 8) - (y-offset 8) + (hitbox 8 8 0 0) (images "extra-star-0.png" "extra-star-1.png" "extra-star-2.png"))) diff --git a/data/images/creatures/tux_small/small-tux-arms.sprite b/data/images/creatures/tux_small/small-tux-arms.sprite index ec2c1413b..6eb7217b4 100644 --- a/data/images/creatures/tux_small/small-tux-arms.sprite +++ b/data/images/creatures/tux_small/small-tux-arms.sprite @@ -2,8 +2,7 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "arms-walk-0.png" "arms-walk-1.png" "arms-walk-2.png" @@ -16,74 +15,63 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "arms-walk-5.png")) (action (name "stand-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "arms-jump-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "jump-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 15) + (hitbox 6 15 0 0) (images "arms-skid-0.png")) (action (name "skid-left") (fps 15.0) - (x-offset 6) - (y-offset 15) + (hitbox 6 15 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "arms-kick-0.png")) (action (name "kick-left") - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "kick-right")) ; Grabbing is arms specific! (action (name "grab-right") - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (z-order 2) (images "arms-grab-0.png")) (action (name "grab-left") - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (z-order 2) (mirror-action "grab-right"))) diff --git a/data/images/creatures/tux_small/small-tux-body.sprite b/data/images/creatures/tux_small/small-tux-body.sprite index 4ad1e104c..ac43066cd 100644 --- a/data/images/creatures/tux_small/small-tux-body.sprite +++ b/data/images/creatures/tux_small/small-tux-body.sprite @@ -2,8 +2,7 @@ (action (name "walk-right") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "body-walk-0.png" "body-walk-1.png" "body-walk-2.png" @@ -16,58 +15,49 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "walk-right")) (action (name "stand-right") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "body-walk-5.png")) (action (name "stand-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "stand-right")) (action (name "jump-right") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "body-jump-0.png")) (action (name "jump-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "jump-right")) (action (name "skid-right") - (x-offset 6) - (y-offset 15) + (hitbox 6 15 0 0) (images "body-skid-0.png")) (action (name "skid-left") - (x-offset 6) - (y-offset 15) + (hitbox 6 15 0 0) (mirror-action "skid-right")) (action (name "kick-right") - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (images "body-kick-0.png")) (action (name "kick-left") - (x-offset 5) - (y-offset 14) + (hitbox 5 14 0 0) (mirror-action "kick-right"))) diff --git a/data/images/creatures/tux_small/smalltux-gameover.sprite b/data/images/creatures/tux_small/smalltux-gameover.sprite index 0a96764a8..e44c86126 100644 --- a/data/images/creatures/tux_small/smalltux-gameover.sprite +++ b/data/images/creatures/tux_small/smalltux-gameover.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action (fps 10.0) - (x-offset 13) - (y-offset 6) + (hitbox 13 6 0 0) (images "gameover-0.png" "gameover-1.png"))) diff --git a/data/images/creatures/tux_small/smalltux-star.sprite b/data/images/creatures/tux_small/smalltux-star.sprite index 97614211f..f363a5071 100644 --- a/data/images/creatures/tux_small/smalltux-star.sprite +++ b/data/images/creatures/tux_small/smalltux-star.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action - (x-offset 5) - (y-offset 15) + (hitbox 5 15 0 0) (images "extra-star-0.png" "extra-star-1.png" "extra-star-2.png"))) diff --git a/data/images/creatures/yeti/yeti.sprite b/data/images/creatures/yeti/yeti.sprite index c18790fc7..975146f41 100644 --- a/data/images/creatures/yeti/yeti.sprite +++ b/data/images/creatures/yeti/yeti.sprite @@ -2,8 +2,7 @@ (action (name "run-right") (fps 4.0) - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) (images "y1.png" "y2.png" @@ -18,50 +17,43 @@ (name "run-left") (mirror-action "run-right") (fps 4.0) - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "jump-right") (images "yeti_jump.png" ) - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "jump-left") (mirror-action "jump-right") - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "stand-right") (images "y.png" ) - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "stand-left") (mirror-action "stand-right") - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "stomp-right") (images "y-jump.png" ) - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "stomp-left") (mirror-action "stomp-right") - (x-offset 17) - (y-offset 12) + (hitbox 17 12 0 0) ) (action (name "dead") @@ -74,7 +66,6 @@ "busted2.png" ) - (x-offset 300) - (y-offset 400) + (hitbox 300 400 0 0) ) ) diff --git a/data/images/creatures/zeekling/zeekling.sprite b/data/images/creatures/zeekling/zeekling.sprite index dccbcbf43..a818c3644 100644 --- a/data/images/creatures/zeekling/zeekling.sprite +++ b/data/images/creatures/zeekling/zeekling.sprite @@ -2,36 +2,30 @@ (supertux-sprite (action (name "left") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (images "left-0.png" "left-1.png" "left-2.png" "left-3.png")) (action (name "right") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (mirror-action "left")) (action (name "squished-left") - (x-offset 2) - (y-offset -19) + (hitbox 2 -19 0 0) (images "squished.png")) (action (name "squished-right") - (x-offset 2) - (y-offset -19) + (hitbox 2 -19 0 0) (mirror-action "squished-left")) (action (name "diving-left") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (images "diving.png")) (action (name "diving-right") - (x-offset 2) - (y-offset 4) + (hitbox 2 4 0 0) (mirror-action "diving-left") ) ) diff --git a/data/images/objects/bullets/firebullet.sprite b/data/images/objects/bullets/firebullet.sprite index 6224912df..c4381ecbd 100644 --- a/data/images/objects/bullets/firebullet.sprite +++ b/data/images/objects/bullets/firebullet.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action - (x-offset 12) - (x-offset 12) + (hitbox 12 12 0 0) (fps 20) (images "fire_bullet-0.png" "fire_bullet-1.png" diff --git a/data/images/objects/bullets/icebullet.sprite b/data/images/objects/bullets/icebullet.sprite index 4a2791488..9f7938cfb 100644 --- a/data/images/objects/bullets/icebullet.sprite +++ b/data/images/objects/bullets/icebullet.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action - (x-offset 12) - (x-offset 12) + (hitbox 12 12 0 0) (fps 20) (images "ice_bullet.png") ) diff --git a/data/images/objects/castledoor/castledoor.sprite b/data/images/objects/castledoor/castledoor.sprite index a0c7e1763..d8ff05156 100644 --- a/data/images/objects/castledoor/castledoor.sprite +++ b/data/images/objects/castledoor/castledoor.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "closed") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (fps 4) (images "castledoor_0.png" )) diff --git a/data/images/objects/castledoor/keyholes.sprite b/data/images/objects/castledoor/keyholes.sprite index 251a33a05..18d2d8491 100644 --- a/data/images/objects/castledoor/keyholes.sprite +++ b/data/images/objects/castledoor/keyholes.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "keyholes.png")) ) diff --git a/data/images/objects/castledoor/torchflame.sprite b/data/images/objects/castledoor/torchflame.sprite index c685b575f..cb204afd2 100644 --- a/data/images/objects/castledoor/torchflame.sprite +++ b/data/images/objects/castledoor/torchflame.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (fps 4) (images diff --git a/data/images/objects/door/door.sprite b/data/images/objects/door/door.sprite index 899f5d8c2..1eea8c793 100644 --- a/data/images/objects/door/door.sprite +++ b/data/images/objects/door/door.sprite @@ -1,13 +1,11 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "door-0.png")) (action (name "open") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "door-0.png" "door-1.png" "door-2.png" diff --git a/data/images/objects/firefly/firefly.sprite b/data/images/objects/firefly/firefly.sprite index ddb9caf8a..08dea16f2 100644 --- a/data/images/objects/firefly/firefly.sprite +++ b/data/images/objects/firefly/firefly.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "firefly1.png") ) (action diff --git a/data/images/objects/hatch/hatch.sprite b/data/images/objects/hatch/hatch.sprite index e871d68ac..8216ae91e 100644 --- a/data/images/objects/hatch/hatch.sprite +++ b/data/images/objects/hatch/hatch.sprite @@ -1,13 +1,11 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "hatch-0.png")) (action (name "open") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "hatch-0.png" "hatch-1.png" "hatch-2.png" diff --git a/data/images/objects/icecube/icecube.sprite b/data/images/objects/icecube/icecube.sprite index 0d626ea86..35f9c134d 100644 --- a/data/images/objects/icecube/icecube.sprite +++ b/data/images/objects/icecube/icecube.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (fps 5) (images "icecube.png" diff --git a/data/images/objects/particles/stomp.sprite b/data/images/objects/particles/stomp.sprite index 4f556d9f0..3df371ea2 100644 --- a/data/images/objects/particles/stomp.sprite +++ b/data/images/objects/particles/stomp.sprite @@ -1,7 +1,6 @@ (supertux-sprite (action - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "stomp.png") ) ) diff --git a/data/images/objects/radio/radio.sprite b/data/images/objects/radio/radio.sprite index 5499a6650..a3fb538af 100644 --- a/data/images/objects/radio/radio.sprite +++ b/data/images/objects/radio/radio.sprite @@ -1,13 +1,11 @@ (supertux-sprite (action (name "quiet") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "radio1.png")) (action (name "loud") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "radio1.png" "radio2.png" "radio3.png") diff --git a/data/images/objects/trampoline/trampoline.sprite b/data/images/objects/trampoline/trampoline.sprite index 4b9e58d9b..ede16f97d 100644 --- a/data/images/objects/trampoline/trampoline.sprite +++ b/data/images/objects/trampoline/trampoline.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "normal") - (x-offset 0) - (y-offset 0) + (hitbox 0 0 0 0) (images "trampoline1-0.png" "trampoline1-1.png" "trampoline1-2.png" diff --git a/data/images/worldmap/common/leveldot.sprite b/data/images/worldmap/common/leveldot.sprite index 03a4ae697..afa203b57 100644 --- a/data/images/worldmap/common/leveldot.sprite +++ b/data/images/worldmap/common/leveldot.sprite @@ -1,14 +1,12 @@ (supertux-sprite (action (name "default") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (images "leveldot_red.png") ) (action (name "solved") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (images "leveldot_green.png") ) ) diff --git a/data/images/worldmap/common/n_stone.sprite b/data/images/worldmap/common/n_stone.sprite index 1819cecfb..70db62e43 100644 --- a/data/images/worldmap/common/n_stone.sprite +++ b/data/images/worldmap/common/n_stone.sprite @@ -1,14 +1,12 @@ (supertux-sprite (action (name "default") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (images "n_stone.png") ) (action (name "solved") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (images "n_stone.png") ) ) diff --git a/data/images/worldmap/common/shroom.sprite b/data/images/worldmap/common/shroom.sprite index a2b0f8ff4..5ed151bea 100644 --- a/data/images/worldmap/common/shroom.sprite +++ b/data/images/worldmap/common/shroom.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "default") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (images "shroom.png" "shroom1.png" "shroom2.png" @@ -20,8 +19,7 @@ ) (action (name "solved") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (images "level_star.png" "level_star1.png" "level_star1.png" diff --git a/data/images/worldmap/common/teleporterdot.sprite b/data/images/worldmap/common/teleporterdot.sprite index 3bf9e0581..e1ce38520 100644 --- a/data/images/worldmap/common/teleporterdot.sprite +++ b/data/images/worldmap/common/teleporterdot.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "default") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (fps 3) (images "teleporterdot_1.png" "teleporterdot_2.png" diff --git a/data/images/worldmap/common/torch.sprite b/data/images/worldmap/common/torch.sprite index c6c283864..e23492ee8 100644 --- a/data/images/worldmap/common/torch.sprite +++ b/data/images/worldmap/common/torch.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "default") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (fps 6) (images "torch.png" @@ -16,8 +15,7 @@ ) (action (name "solved") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (fps 1) (images "smoke1.png" "smoke2.png" diff --git a/data/images/worldmap/common/torch1.sprite b/data/images/worldmap/common/torch1.sprite index bb1f1148e..afc766816 100644 --- a/data/images/worldmap/common/torch1.sprite +++ b/data/images/worldmap/common/torch1.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "default") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (fps 6) (images "torch.png" "torch.png" @@ -16,8 +15,7 @@ ) (action (name "solved") - (x-offset 16) - (y-offset 16) + (hitbox 16 16 0 0) (fps 1) (images "smoke1.png" "smoke2.png" diff --git a/data/images/worldmap/common/tux.sprite b/data/images/worldmap/common/tux.sprite index a8baa1254..4ac6a318e 100644 --- a/data/images/worldmap/common/tux.sprite +++ b/data/images/worldmap/common/tux.sprite @@ -1,14 +1,12 @@ (supertux-sprite (action (name "small-stop") - (x-offset 5) - (y-offset 20) + (hitbox 5 20 0 0) (images "smalltux.png") ) (action (name "small-walking") - (x-offset 5) - (y-offset 20) + (hitbox 5 20 0 0) (images "smalltux.png" "smalltux1.png" "smalltux2.png" @@ -30,22 +28,22 @@ ) (action (name "large-walking") - (y-offset 10) + (hitbox 0 10 0 0) (images "tux.png") ) (action (name "large-stop") - (y-offset 10) + (hitbox 0 10 0 0) (images "tux.png") ) (action (name "fire-walking") - (y-offset 10) + (hitbox 0 10 0 0) (images "firetux.png") ) (action (name "fire-stop") - (y-offset 10) + (hitbox 0 10 0 0) (images "firetux.png") ) ) diff --git a/data/images/worldmap/common/yeti.sprite b/data/images/worldmap/common/yeti.sprite index ee68ba778..fe84c67fd 100644 --- a/data/images/worldmap/common/yeti.sprite +++ b/data/images/worldmap/common/yeti.sprite @@ -1,8 +1,7 @@ (supertux-sprite (action (name "default") - (x-offset 0) - (y-offset 65) + (hitbox 0 65 0 0) (fps 5) (images "../../creatures/yeti/worldmap_1.png" "../../creatures/yeti/worldmap_1.png" @@ -41,8 +40,7 @@ ) (action (name "solved") - (x-offset 0) - (y-offset 65) + (hitbox 0 65 0 0) (fps 3) (images "../../creatures/yeti/iceyeti_dust_wm_0.png" "../../creatures/yeti/iceyeti_dust_wm_1.png" diff --git a/src/badguy/mrtree.cpp b/src/badguy/mrtree.cpp index 6eeb74613..c4d33f113 100644 --- a/src/badguy/mrtree.cpp +++ b/src/badguy/mrtree.cpp @@ -26,13 +26,19 @@ static const float WALKSPEED = 100; static const float WALKSPEED_SMALL = 120; static const float INVINCIBLE_TIME = 1; +static const float POISONIVY_WIDTH = 32; +static const float POISONIVY_HEIGHT = 32; +static const float POISONIVY_Y_OFFSET = 24; + + MrTree::MrTree(const lisp::Lisp& reader) : mystate(STATE_BIG) { reader.get("x", start_position.x); reader.get("y", start_position.y); - bbox.set_size(84.8, 84.8); sprite = sprite_manager->create("images/creatures/mr_tree/mr_tree.sprite"); + sprite->set_action(dir == LEFT ? "large-left" : "large-right"); + bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height()); } void @@ -90,24 +96,29 @@ MrTree::collision_squished(Player& player) if(mystate == STATE_BIG) { mystate = STATE_INVINCIBLE; invincible_timer.start(INVINCIBLE_TIME); + + float old_x_offset = sprite->get_current_hitbox_x_offset(); + float old_y_offset = sprite->get_current_hitbox_y_offset(); activate(); // shrink bounding box and adjust sprite position to where the stump once was - bbox.set_size(42, 62); + bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height()); Vector pos = get_pos(); - pos.x += 20; - pos.y += 23; + pos.x += sprite->get_current_hitbox_x_offset() - old_x_offset; + pos.y += sprite->get_current_hitbox_y_offset() - old_y_offset; set_pos(pos); sound_manager->play("sounds/mr_tree.ogg", get_pos()); player.bounce(*this); - Rect leaf1_bbox = Rect(pos.x-32-1, pos.y-23+1, pos.x-32-1+32, pos.y-23+1+32); + Vector leaf1_pos = Vector(pos.x - POISONIVY_WIDTH - 1, pos.y - POISONIVY_Y_OFFSET); + Rect leaf1_bbox = Rect(leaf1_pos.x, leaf1_pos.y, leaf1_pos.x + POISONIVY_WIDTH, leaf1_pos.y + POISONIVY_HEIGHT); if (Sector::current()->is_free_space(leaf1_bbox)) { PoisonIvy* leaf1 = new PoisonIvy(leaf1_bbox.p1.x, leaf1_bbox.p1.y, LEFT); Sector::current()->add_object(leaf1); } - Rect leaf2_bbox = Rect(pos.x+42+1, pos.y-23+1, pos.x+32+1+32, pos.y-23+1+32); + Vector leaf2_pos = Vector(pos.x + sprite->get_current_hitbox_width() + 1, pos.y - POISONIVY_Y_OFFSET); + Rect leaf2_bbox = Rect(leaf2_pos.x, leaf2_pos.y, leaf2_pos.x + POISONIVY_WIDTH, leaf2_pos.y + POISONIVY_HEIGHT); if (Sector::current()->is_free_space(leaf2_bbox)) { PoisonIvy* leaf2 = new PoisonIvy(leaf2_bbox.p1.x, leaf2_bbox.p1.y, RIGHT); Sector::current()->add_object(leaf2); @@ -126,7 +137,7 @@ MrTree::collision_squished(Player& player) // if we're small, we die if (mystate == STATE_NORMAL) { sprite->set_action(dir == LEFT ? "squished-left" : "squished-right"); - bbox.set_size(42, 42); + bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height()); kill_squished(player); return true; } diff --git a/src/sprite/sprite.cpp b/src/sprite/sprite.cpp index 82d0d7c46..43f582a16 100644 --- a/src/sprite/sprite.cpp +++ b/src/sprite/sprite.cpp @@ -142,6 +142,30 @@ Sprite::get_height() const return (int) action->surfaces[get_frame()]->get_height(); } +float +Sprite::get_current_hitbox_x_offset() const +{ + return action->x_offset; +} + +float +Sprite::get_current_hitbox_y_offset() const +{ + return action->y_offset; +} + +float +Sprite::get_current_hitbox_width() const +{ + return action->hitbox_w; +} + +float +Sprite::get_current_hitbox_height() const +{ + return action->hitbox_h; +} + void Sprite::set_fps(float new_fps) { diff --git a/src/sprite/sprite.hpp b/src/sprite/sprite.hpp index 229f6340b..9c138e200 100644 --- a/src/sprite/sprite.hpp +++ b/src/sprite/sprite.hpp @@ -70,6 +70,15 @@ public: int get_width() const; int get_height() const; + /** return x-offset of current action's hitbox, relative to start of image */ + float get_current_hitbox_x_offset() const; + /** return y-offset of current action's hitbox, relative to start of image */ + float get_current_hitbox_y_offset() const; + /** return width of current action's hitbox */ + float get_current_hitbox_width() const; + /** return height of current action's hitbox */ + float get_current_hitbox_height() const; + /** Get current frame */ int get_frame() const { return (int)frame; } diff --git a/src/sprite/sprite_data.cpp b/src/sprite/sprite_data.cpp index cf0b7a7cc..599e4e1d8 100644 --- a/src/sprite/sprite_data.cpp +++ b/src/sprite/sprite_data.cpp @@ -34,6 +34,8 @@ SpriteData::Action::Action() { x_offset = 0; y_offset = 0; + hitbox_w = 0; + hitbox_h = 0; z_order = 0; fps = 10; } @@ -77,8 +79,14 @@ SpriteData::parse_action(const lisp::Lisp* lisp, const std::string& basedir) throw std::runtime_error( "If there are more than one action, they need names!"); } - lisp->get("x-offset", action->x_offset); - lisp->get("y-offset", action->y_offset); + std::vector hitbox; + if (lisp->get_vector("hitbox", hitbox)) { + if (hitbox.size() != 4) throw std::runtime_error("hitbox must specify exactly 4 coordinates"); + action->x_offset = hitbox[0]; + action->y_offset = hitbox[1]; + action->hitbox_w = hitbox[2]; + action->hitbox_h = hitbox[3]; + } lisp->get("z-order", action->z_order); lisp->get("fps", action->fps); @@ -90,12 +98,18 @@ SpriteData::parse_action(const lisp::Lisp* lisp, const std::string& basedir) throw std::runtime_error("Could not mirror action. Action not found\n" "Mirror actions must be defined after the real one!"); } else { + float max_w = 0; + float max_h = 0; for(int i = 0; static_cast(i) < act_tmp->surfaces.size(); i++) { Surface* surface = new Surface(*(act_tmp->surfaces[i])); surface->hflip(); + max_w = std::max(max_w, surface->get_width()); + max_h = std::max(max_h, surface->get_height()); action->surfaces.push_back(surface); } + if (action->hitbox_w < 1) action->hitbox_w = max_w; + if (action->hitbox_h < 1) action->hitbox_h = max_h; } } else { // Load images std::vector images; @@ -106,9 +120,16 @@ SpriteData::parse_action(const lisp::Lisp* lisp, const std::string& basedir) throw std::runtime_error(msg.str()); } + float max_w = 0; + float max_h = 0; for(std::vector::size_type i = 0; i < images.size(); i++) { - action->surfaces.push_back(new Surface(basedir + images[i])); + Surface* surface = new Surface(basedir + images[i]); + max_w = std::max(max_w, surface->get_width()); + max_h = std::max(max_h, surface->get_height()); + action->surfaces.push_back(surface); } + if (action->hitbox_w < 1) action->hitbox_w = max_w; + if (action->hitbox_h < 1) action->hitbox_h = max_h; } actions[action->name] = action; } diff --git a/src/sprite/sprite_data.hpp b/src/sprite/sprite_data.hpp index e1e8b8fa0..3f73f4c1f 100644 --- a/src/sprite/sprite_data.hpp +++ b/src/sprite/sprite_data.hpp @@ -30,8 +30,7 @@ class SpriteData { public: - /** cur has to be a pointer to data in the form of ((x-offset 5) - (y-offset 10) ...) */ + /** cur has to be a pointer to data in the form of ((hitbox 5 10 0 0) ...) */ SpriteData(const lisp::Lisp* cur, const std::string& basedir); ~SpriteData(); @@ -51,8 +50,15 @@ private: std::string name; /** Position correction */ - int x_offset; - int y_offset; + float x_offset; + float y_offset; + + /** Hitbox width */ + float hitbox_w; + + /** Hitbox height */ + float hitbox_h; + /** Drawing priority in queue */ int z_order; -- 2.11.0