diff --git a/data/images/creatures/darttrap/granito/charge_down-0.png b/data/images/creatures/darttrap/granito/charge_down-0.png new file mode 100644 index 00000000000..32ea8658e79 Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_down-0.png differ diff --git a/data/images/creatures/darttrap/granito/charge_down-1.png b/data/images/creatures/darttrap/granito/charge_down-1.png new file mode 100644 index 00000000000..cdbb365d0b8 Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_down-1.png differ diff --git a/data/images/creatures/darttrap/granito/charge_down-2.png b/data/images/creatures/darttrap/granito/charge_down-2.png new file mode 100644 index 00000000000..f5d7258dab6 Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_down-2.png differ diff --git a/data/images/creatures/darttrap/granito/charge_down-3.png b/data/images/creatures/darttrap/granito/charge_down-3.png new file mode 100644 index 00000000000..fac5f4aeefd Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_down-3.png differ diff --git a/data/images/creatures/darttrap/granito/charge_left-0.png b/data/images/creatures/darttrap/granito/charge_left-0.png new file mode 100644 index 00000000000..4e4865e95a9 Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_left-0.png differ diff --git a/data/images/creatures/darttrap/granito/charge_left-1.png b/data/images/creatures/darttrap/granito/charge_left-1.png new file mode 100644 index 00000000000..0e89373773a Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_left-1.png differ diff --git a/data/images/creatures/darttrap/granito/charge_left-2.png b/data/images/creatures/darttrap/granito/charge_left-2.png new file mode 100644 index 00000000000..2fe46b57129 Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_left-2.png differ diff --git a/data/images/creatures/darttrap/granito/charge_left-3.png b/data/images/creatures/darttrap/granito/charge_left-3.png new file mode 100644 index 00000000000..8b4ac4739ad Binary files /dev/null and b/data/images/creatures/darttrap/granito/charge_left-3.png differ diff --git a/data/images/creatures/darttrap/granito/dart_light.png b/data/images/creatures/darttrap/granito/dart_light.png new file mode 100644 index 00000000000..0009d74ec1f Binary files /dev/null and b/data/images/creatures/darttrap/granito/dart_light.png differ diff --git a/data/images/creatures/darttrap/granito/darttrap_granito.sprite b/data/images/creatures/darttrap/granito/darttrap_granito.sprite new file mode 100644 index 00000000000..6d50cd7aef8 --- /dev/null +++ b/data/images/creatures/darttrap/granito/darttrap_granito.sprite @@ -0,0 +1,61 @@ +(supertux-sprite + (action + (hitbox -3 -3 32 64) + (name "idle-left") + (images "empty_left.png") + ) + (action + (hitbox 17 -3 32 64) + (name "idle-right") + (mirror-action "idle-left") + ) + (action + (hitbox -3 17 64 32) + (name "idle-down") + (images "empty_down.png") + ) + (action + (hitbox -3 -3 64 32) + (name "idle-up") + (flip-action "idle-down") + ) + + (action + (hitbox -3 -3 32 64) + (name "loading-left") + (fps 15) + (loops 1) + (images + "empty_left.png" + "charge_left-0.png" + "charge_left-1.png" + "charge_left-2.png" + "charge_left-3.png") + ) + (action + (hitbox 17 -3 32 64) + (name "loading-right") + (fps 15) + (loops 1) + (mirror-action "loading-left") + ) + (action + (hitbox -3 17 64 32) + (name "loading-down") + (fps 15) + (loops 1) + (images + "empty_down.png" + "charge_down-0.png" + "charge_down-1.png" + "charge_down-2.png" + "charge_down-3.png") + ) + (action + (hitbox -3 -3 64 32) + (name "loading-up") + (fps 15) + (loops 1) + (flip-action "loading-down") + ) +) diff --git a/data/images/creatures/darttrap/granito/empty_down.png b/data/images/creatures/darttrap/granito/empty_down.png new file mode 100644 index 00000000000..6681a36aef9 Binary files /dev/null and b/data/images/creatures/darttrap/granito/empty_down.png differ diff --git a/data/images/creatures/darttrap/granito/empty_left.png b/data/images/creatures/darttrap/granito/empty_left.png new file mode 100644 index 00000000000..7cc0d09412c Binary files /dev/null and b/data/images/creatures/darttrap/granito/empty_left.png differ diff --git a/data/images/creatures/darttrap/granito/root_dart.sprite b/data/images/creatures/darttrap/granito/root_dart.sprite new file mode 100644 index 00000000000..a9dc94d6b2d --- /dev/null +++ b/data/images/creatures/darttrap/granito/root_dart.sprite @@ -0,0 +1,22 @@ +(supertux-sprite + (action + (name "flying-left") + (hitbox 6 13 20 8) + (images "root_dart_left.png") + ) + (action + (name "flying-right") + (hitbox 6 13 20 8) + (mirror-action "flying-left") + ) + (action + (name "flying-down") + (hitbox 13 6 8 20) + (images "root_dart_down.png") + ) + (action + (name "flying-up") + (hitbox 13 6 8 20) + (flip-action "flying-down") + ) + ) diff --git a/data/images/creatures/darttrap/granito/root_dart_down.png b/data/images/creatures/darttrap/granito/root_dart_down.png new file mode 100644 index 00000000000..ad777b03962 Binary files /dev/null and b/data/images/creatures/darttrap/granito/root_dart_down.png differ diff --git a/data/images/creatures/darttrap/granito/root_dart_left.png b/data/images/creatures/darttrap/granito/root_dart_left.png new file mode 100644 index 00000000000..2923a8cec77 Binary files /dev/null and b/data/images/creatures/darttrap/granito/root_dart_left.png differ diff --git a/data/images/creatures/darttrap/charge_down-0.png b/data/images/creatures/darttrap/skull/charge_down-0.png similarity index 100% rename from data/images/creatures/darttrap/charge_down-0.png rename to data/images/creatures/darttrap/skull/charge_down-0.png diff --git a/data/images/creatures/darttrap/charge_down-1.png b/data/images/creatures/darttrap/skull/charge_down-1.png similarity index 100% rename from data/images/creatures/darttrap/charge_down-1.png rename to data/images/creatures/darttrap/skull/charge_down-1.png diff --git a/data/images/creatures/darttrap/charge_down-2.png b/data/images/creatures/darttrap/skull/charge_down-2.png similarity index 100% rename from data/images/creatures/darttrap/charge_down-2.png rename to data/images/creatures/darttrap/skull/charge_down-2.png diff --git a/data/images/creatures/darttrap/charge_down-3.png b/data/images/creatures/darttrap/skull/charge_down-3.png similarity index 100% rename from data/images/creatures/darttrap/charge_down-3.png rename to data/images/creatures/darttrap/skull/charge_down-3.png diff --git a/data/images/creatures/darttrap/charge_left-0.png b/data/images/creatures/darttrap/skull/charge_left-0.png similarity index 100% rename from data/images/creatures/darttrap/charge_left-0.png rename to data/images/creatures/darttrap/skull/charge_left-0.png diff --git a/data/images/creatures/darttrap/charge_left-1.png b/data/images/creatures/darttrap/skull/charge_left-1.png similarity index 100% rename from data/images/creatures/darttrap/charge_left-1.png rename to data/images/creatures/darttrap/skull/charge_left-1.png diff --git a/data/images/creatures/darttrap/charge_left-2.png b/data/images/creatures/darttrap/skull/charge_left-2.png similarity index 100% rename from data/images/creatures/darttrap/charge_left-2.png rename to data/images/creatures/darttrap/skull/charge_left-2.png diff --git a/data/images/creatures/darttrap/charge_left-3.png b/data/images/creatures/darttrap/skull/charge_left-3.png similarity index 100% rename from data/images/creatures/darttrap/charge_left-3.png rename to data/images/creatures/darttrap/skull/charge_left-3.png diff --git a/data/images/creatures/darttrap/dart_light.png b/data/images/creatures/darttrap/skull/dart_light.png similarity index 100% rename from data/images/creatures/darttrap/dart_light.png rename to data/images/creatures/darttrap/skull/dart_light.png diff --git a/data/images/creatures/darttrap/skull/darttrap_skull.sprite b/data/images/creatures/darttrap/skull/darttrap_skull.sprite new file mode 100644 index 00000000000..00d0e2515d6 --- /dev/null +++ b/data/images/creatures/darttrap/skull/darttrap_skull.sprite @@ -0,0 +1,79 @@ +(supertux-sprite + (action + (hitbox -8 2 32 64) + (name "idle-left") + (loops 1) + (fps 10) + (images "empty_left-0.png" + "empty_left-1.png" + "empty_left-2.png" + "empty_left-3.png" + "empty_left-4.png" + ) + ) + (action + (hitbox 14 2 32 64) + (name "idle-right") + (loops 1) + (fps 10) + (mirror-action "idle-left") + ) + (action + (hitbox 2 14 64 32) + (name "idle-down") + (loops 1) + (fps 10) + (images "empty_down-0.png" + "empty_down-1.png" + "empty_down-2.png" + "empty_down-3.png" + "empty_down-4.png" + ) + ) + (action + (hitbox 2 -8 64 32) + (name "idle-up") + (loops 1) + (fps 10) + (flip-action "idle-down") + ) + + (action + (hitbox -8 2 32 64) + (name "loading-left") + (loops 1) + (fps 10) + (images "empty_left-4.png" + "charge_left-0.png" + "charge_left-1.png" + "charge_left-2.png" + "charge_left-3.png" + ) + ) + (action + (hitbox 14 2 32 64) + (name "loading-right") + (loops 1) + (fps 10) + (mirror-action "loading-left") + ) + (action + (hitbox 2 14 64 32) + (name "loading-down") + (loops 1) + (fps 10) + (images "empty_down-4.png" + "charge_down-0.png" + "charge_down-1.png" + "charge_down-2.png" + "charge_down-3.png" + ) + ) + (action + (hitbox 2 -8 64 32) + (name "loading-up") + (loops 1) + (fps 10) + (flip-action "loading-down") + ) +) diff --git a/data/images/creatures/darttrap/empty_down-0.png b/data/images/creatures/darttrap/skull/empty_down-0.png similarity index 100% rename from data/images/creatures/darttrap/empty_down-0.png rename to data/images/creatures/darttrap/skull/empty_down-0.png diff --git a/data/images/creatures/darttrap/empty_down-1.png b/data/images/creatures/darttrap/skull/empty_down-1.png similarity index 100% rename from data/images/creatures/darttrap/empty_down-1.png rename to data/images/creatures/darttrap/skull/empty_down-1.png diff --git a/data/images/creatures/darttrap/empty_down-2.png b/data/images/creatures/darttrap/skull/empty_down-2.png similarity index 100% rename from data/images/creatures/darttrap/empty_down-2.png rename to data/images/creatures/darttrap/skull/empty_down-2.png diff --git a/data/images/creatures/darttrap/empty_down-3.png b/data/images/creatures/darttrap/skull/empty_down-3.png similarity index 100% rename from data/images/creatures/darttrap/empty_down-3.png rename to data/images/creatures/darttrap/skull/empty_down-3.png diff --git a/data/images/creatures/darttrap/empty_down-4.png b/data/images/creatures/darttrap/skull/empty_down-4.png similarity index 100% rename from data/images/creatures/darttrap/empty_down-4.png rename to data/images/creatures/darttrap/skull/empty_down-4.png diff --git a/data/images/creatures/darttrap/empty_left-0.png b/data/images/creatures/darttrap/skull/empty_left-0.png similarity index 100% rename from data/images/creatures/darttrap/empty_left-0.png rename to data/images/creatures/darttrap/skull/empty_left-0.png diff --git a/data/images/creatures/darttrap/empty_left-1.png b/data/images/creatures/darttrap/skull/empty_left-1.png similarity index 100% rename from data/images/creatures/darttrap/empty_left-1.png rename to data/images/creatures/darttrap/skull/empty_left-1.png diff --git a/data/images/creatures/darttrap/empty_left-2.png b/data/images/creatures/darttrap/skull/empty_left-2.png similarity index 100% rename from data/images/creatures/darttrap/empty_left-2.png rename to data/images/creatures/darttrap/skull/empty_left-2.png diff --git a/data/images/creatures/darttrap/empty_left-3.png b/data/images/creatures/darttrap/skull/empty_left-3.png similarity index 100% rename from data/images/creatures/darttrap/empty_left-3.png rename to data/images/creatures/darttrap/skull/empty_left-3.png diff --git a/data/images/creatures/darttrap/empty_left-4.png b/data/images/creatures/darttrap/skull/empty_left-4.png similarity index 100% rename from data/images/creatures/darttrap/empty_left-4.png rename to data/images/creatures/darttrap/skull/empty_left-4.png diff --git a/data/images/creatures/darttrap/skull_dart.sprite b/data/images/creatures/darttrap/skull/skull_dart.sprite similarity index 100% rename from data/images/creatures/darttrap/skull_dart.sprite rename to data/images/creatures/darttrap/skull/skull_dart.sprite diff --git a/data/images/creatures/darttrap/skull_dart_down.png b/data/images/creatures/darttrap/skull/skull_dart_down.png similarity index 100% rename from data/images/creatures/darttrap/skull_dart_down.png rename to data/images/creatures/darttrap/skull/skull_dart_down.png diff --git a/data/images/creatures/darttrap/skull_dart_left.png b/data/images/creatures/darttrap/skull/skull_dart_left.png similarity index 100% rename from data/images/creatures/darttrap/skull_dart_left.png rename to data/images/creatures/darttrap/skull/skull_dart_left.png diff --git a/data/images/creatures/granito/corrupted/big/rock_mine-0.png b/data/images/creatures/granito/corrupted/big/rock_mine-0.png new file mode 100644 index 00000000000..64e93f660a7 Binary files /dev/null and b/data/images/creatures/granito/corrupted/big/rock_mine-0.png differ diff --git a/data/images/creatures/granito/corrupted/big/rock_mine-1.png b/data/images/creatures/granito/corrupted/big/rock_mine-1.png new file mode 100644 index 00000000000..f91b5502a5f Binary files /dev/null and b/data/images/creatures/granito/corrupted/big/rock_mine-1.png differ diff --git a/data/images/creatures/granito/corrupted/big/rock_mine-2.png b/data/images/creatures/granito/corrupted/big/rock_mine-2.png new file mode 100644 index 00000000000..d33193bb89d Binary files /dev/null and b/data/images/creatures/granito/corrupted/big/rock_mine-2.png differ diff --git a/data/images/creatures/granito/corrupted/big/rock_mine-3.png b/data/images/creatures/granito/corrupted/big/rock_mine-3.png new file mode 100644 index 00000000000..08f50edb663 Binary files /dev/null and b/data/images/creatures/granito/corrupted/big/rock_mine-3.png differ diff --git a/data/images/creatures/granito/corrupted/big/rock_mine.sprite b/data/images/creatures/granito/corrupted/big/rock_mine.sprite new file mode 100644 index 00000000000..1f46b1f58f8 --- /dev/null +++ b/data/images/creatures/granito/corrupted/big/rock_mine.sprite @@ -0,0 +1,43 @@ +(supertux-sprite + (action + (name "idle-left") + (hitbox 18 26 48 48) + (images "rock_mine-0.png") + ) + (action + (name "cracked-1-left") + (hitbox 18 26 48 48) + (images "rock_mine-1.png") + ) + (action + (name "cracked-2-left") + (hitbox 18 26 48 48) + (images "rock_mine-2.png") + ) + (action + (name "broken-left") + (hitbox 18 26 48 48) + (images "rock_mine-3.png") + ) + + (action + (name "idle-right") + (hitbox 18 26 48 48) + (mirror-action "idle-left") + ) + (action + (name "cracked-1-right") + (hitbox 18 26 48 48) + (mirror-action "cracked-1-left") + ) + (action + (name "cracked-2-right") + (hitbox 18 26 48 48) + (mirror-action "cracked-2-left") + ) + (action + (name "broken-right") + (hitbox 18 26 48 48) + (mirror-action "broken-left") + ) +) diff --git a/data/images/creatures/granito/corrupted/big/root_spike.png b/data/images/creatures/granito/corrupted/big/root_spike.png new file mode 100644 index 00000000000..a08b1705d6a Binary files /dev/null and b/data/images/creatures/granito/corrupted/big/root_spike.png differ diff --git a/data/images/creatures/granito/corrupted/big/root_spike.sprite b/data/images/creatures/granito/corrupted/big/root_spike.sprite new file mode 100644 index 00000000000..6e0a881aa50 --- /dev/null +++ b/data/images/creatures/granito/corrupted/big/root_spike.sprite @@ -0,0 +1,6 @@ +(supertux-sprite + (action + (name "default") + (hitbox 11 11 16 16) + (images "root_spike.png")) +) diff --git a/data/images/creatures/granito/corrupted/corrupted_granito.sprite b/data/images/creatures/granito/corrupted/corrupted_granito.sprite new file mode 100644 index 00000000000..f2ad8d78929 --- /dev/null +++ b/data/images/creatures/granito/corrupted/corrupted_granito.sprite @@ -0,0 +1,73 @@ +(supertux-sprite + (action + (name "standing-left") + (hitbox 15 15 32 42) + (fps 15) + (loops 1) + (images "idle_left-0.png" + "idle_left-1.png" + "idle_left-2.png" + "idle_left-3.png" + "idle_left-4.png" + "idle_left-5.png")) + + (action + (name "standing-right") + (hitbox 28 15 32 42) + (fps 15) + (loops 1) + (images "idle_right-0.png" + "idle_right-1.png" + "idle_right-2.png" + "idle_right-3.png" + "idle_right-4.png" + "idle_right-5.png")) + + (action + (name "charging-left") + (hitbox 15 15 32 42) + (loops 1) + (fps 20) + (images "idle_left-0.png" + "idle_left-1.png" + "idle_left-2.png")) + + (action + (name "charging-right") + (hitbox 28 15 32 42) + (loops 1) + (fps 20) + (images "idle_right-0.png" + "idle_right-1.png" + "idle_right-2.png")) + + (action + (name "jumping-left") + (hitbox 15 15 32 42) + (loops 1) + (fps 20) + (images "jump_left-0.png" + "jump_left-1.png" + "jump_left-2.png" + "jump_left-3.png")) + + (action + (name "jumping-right") + (hitbox 28 15 32 42) + (loops 1) + (fps 20) + (images "jump_right-0.png" + "jump_right-1.png" + "jump_right-2.png" + "jump_right-3.png")) + + (action + (name "squished-left") + (hitbox 15 15 32 42) + (images "squished-left.png")) + + (action + (name "squished-right") + (hitbox 28 15 32 42) + (images "squished-right.png")) +) diff --git a/data/images/creatures/granito/corrupted/giant/corrupted_giant.sprite b/data/images/creatures/granito/corrupted/giant/corrupted_giant.sprite new file mode 100644 index 00000000000..d4baa174376 --- /dev/null +++ b/data/images/creatures/granito/corrupted/giant/corrupted_giant.sprite @@ -0,0 +1,36 @@ +(supertux-sprite + (action + (name "husk1-left") + (hitbox 85 27 90 156) + (fps 5) + (images "corrupted_granito_husk-0.png") + ) + (action + (name "husk1-right") + (hitbox 47 27 90 156) + (fps 5) + (mirror-action "husk1-left") + ) + (action + (name "husk2-left") + (hitbox 88 28 80 156) + (images "corrupted_granito_husk-1.png") + ) + (action + (name "husk2-right") + (hitbox 82 28 80 156) + (mirror-action "husk2-left") + ) + (action + (name "husk3-left") + (hitbox 69 36 80 148) + (fps 5) + (images "corrupted_granito_husk-2.png") + ) + (action + (name "husk3-right") + (hitbox 89 36 80 148) + (fps 5) + (mirror-action "husk3-left") + ) +) diff --git a/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-0.png b/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-0.png new file mode 100644 index 00000000000..9554650dea4 Binary files /dev/null and b/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-0.png differ diff --git a/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-1.png b/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-1.png new file mode 100644 index 00000000000..5c1ebc4295f Binary files /dev/null and b/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-1.png differ diff --git a/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-2.png b/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-2.png new file mode 100644 index 00000000000..1cead545619 Binary files /dev/null and b/data/images/creatures/granito/corrupted/giant/corrupted_granito_husk-2.png differ diff --git a/data/images/creatures/granito/corrupted/hive/granito_hive-0.png b/data/images/creatures/granito/corrupted/hive/granito_hive-0.png new file mode 100644 index 00000000000..0a9e4a88412 Binary files /dev/null and b/data/images/creatures/granito/corrupted/hive/granito_hive-0.png differ diff --git a/data/images/creatures/granito/corrupted/hive/granito_hive.sprite b/data/images/creatures/granito/corrupted/hive/granito_hive.sprite new file mode 100644 index 00000000000..f0df15a0ef9 --- /dev/null +++ b/data/images/creatures/granito/corrupted/hive/granito_hive.sprite @@ -0,0 +1,12 @@ +(supertux-sprite + (action + (name "left") + (hitbox 24 4 56 46) + (images "granito_hive-0.png") + ) + (action + (name "right") + (hitbox 30 4 56 46) + (mirror-action "left"); + ) +) diff --git a/data/images/creatures/granito/corrupted/idle_left-0.png b/data/images/creatures/granito/corrupted/idle_left-0.png new file mode 100644 index 00000000000..d39b189bc3f Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_left-0.png differ diff --git a/data/images/creatures/granito/corrupted/idle_left-1.png b/data/images/creatures/granito/corrupted/idle_left-1.png new file mode 100644 index 00000000000..e257bb9cddf Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_left-1.png differ diff --git a/data/images/creatures/granito/corrupted/idle_left-2.png b/data/images/creatures/granito/corrupted/idle_left-2.png new file mode 100644 index 00000000000..a9d47bea445 Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_left-2.png differ diff --git a/data/images/creatures/granito/corrupted/idle_left-3.png b/data/images/creatures/granito/corrupted/idle_left-3.png new file mode 100644 index 00000000000..63e16b30f56 Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_left-3.png differ diff --git a/data/images/creatures/granito/corrupted/idle_left-4.png b/data/images/creatures/granito/corrupted/idle_left-4.png new file mode 100644 index 00000000000..abfe05a44ac Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_left-4.png differ diff --git a/data/images/creatures/granito/corrupted/idle_left-5.png b/data/images/creatures/granito/corrupted/idle_left-5.png new file mode 100644 index 00000000000..ea3f53f61cb Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_left-5.png differ diff --git a/data/images/creatures/granito/corrupted/idle_right-0.png b/data/images/creatures/granito/corrupted/idle_right-0.png new file mode 100644 index 00000000000..0a137b65dd2 Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_right-0.png differ diff --git a/data/images/creatures/granito/corrupted/idle_right-1.png b/data/images/creatures/granito/corrupted/idle_right-1.png new file mode 100644 index 00000000000..a3df55a0cc0 Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_right-1.png differ diff --git a/data/images/creatures/granito/corrupted/idle_right-2.png b/data/images/creatures/granito/corrupted/idle_right-2.png new file mode 100644 index 00000000000..4503fea333b Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_right-2.png differ diff --git a/data/images/creatures/granito/corrupted/idle_right-3.png b/data/images/creatures/granito/corrupted/idle_right-3.png new file mode 100644 index 00000000000..ee7c26ff37b Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_right-3.png differ diff --git a/data/images/creatures/granito/corrupted/idle_right-4.png b/data/images/creatures/granito/corrupted/idle_right-4.png new file mode 100644 index 00000000000..02846876511 Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_right-4.png differ diff --git a/data/images/creatures/granito/corrupted/idle_right-5.png b/data/images/creatures/granito/corrupted/idle_right-5.png new file mode 100644 index 00000000000..17a5b50f731 Binary files /dev/null and b/data/images/creatures/granito/corrupted/idle_right-5.png differ diff --git a/data/images/creatures/granito/corrupted/jump_left-0.png b/data/images/creatures/granito/corrupted/jump_left-0.png new file mode 100644 index 00000000000..1227dc16034 Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_left-0.png differ diff --git a/data/images/creatures/granito/corrupted/jump_left-1.png b/data/images/creatures/granito/corrupted/jump_left-1.png new file mode 100644 index 00000000000..c844e68d0fd Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_left-1.png differ diff --git a/data/images/creatures/granito/corrupted/jump_left-2.png b/data/images/creatures/granito/corrupted/jump_left-2.png new file mode 100644 index 00000000000..8c93a033522 Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_left-2.png differ diff --git a/data/images/creatures/granito/corrupted/jump_left-3.png b/data/images/creatures/granito/corrupted/jump_left-3.png new file mode 100644 index 00000000000..cfebdb3e05c Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_left-3.png differ diff --git a/data/images/creatures/granito/corrupted/jump_right-0.png b/data/images/creatures/granito/corrupted/jump_right-0.png new file mode 100644 index 00000000000..fcac3eefff9 Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_right-0.png differ diff --git a/data/images/creatures/granito/corrupted/jump_right-1.png b/data/images/creatures/granito/corrupted/jump_right-1.png new file mode 100644 index 00000000000..81aefb45780 Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_right-1.png differ diff --git a/data/images/creatures/granito/corrupted/jump_right-2.png b/data/images/creatures/granito/corrupted/jump_right-2.png new file mode 100644 index 00000000000..798b935b4ef Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_right-2.png differ diff --git a/data/images/creatures/granito/corrupted/jump_right-3.png b/data/images/creatures/granito/corrupted/jump_right-3.png new file mode 100644 index 00000000000..f8e5a7a15d3 Binary files /dev/null and b/data/images/creatures/granito/corrupted/jump_right-3.png differ diff --git a/data/images/creatures/granito/corrupted/squished-left.png b/data/images/creatures/granito/corrupted/squished-left.png new file mode 100644 index 00000000000..8ca154ec0cf Binary files /dev/null and b/data/images/creatures/granito/corrupted/squished-left.png differ diff --git a/data/images/creatures/granito/corrupted/squished-right.png b/data/images/creatures/granito/corrupted/squished-right.png new file mode 100644 index 00000000000..9bc3acee316 Binary files /dev/null and b/data/images/creatures/granito/corrupted/squished-right.png differ diff --git a/data/images/creatures/skullyhop/charge_down-0.png b/data/images/creatures/skullyhop/charge_down-0.png new file mode 100644 index 00000000000..76b896dcdf7 Binary files /dev/null and b/data/images/creatures/skullyhop/charge_down-0.png differ diff --git a/data/images/creatures/skullyhop/charge_down-1.png b/data/images/creatures/skullyhop/charge_down-1.png new file mode 100644 index 00000000000..17b736cb6c0 Binary files /dev/null and b/data/images/creatures/skullyhop/charge_down-1.png differ diff --git a/data/images/creatures/skullyhop/charge_down-2.png b/data/images/creatures/skullyhop/charge_down-2.png new file mode 100644 index 00000000000..57a8f60997b Binary files /dev/null and b/data/images/creatures/skullyhop/charge_down-2.png differ diff --git a/data/images/creatures/skullyhop/charge_down-3.png b/data/images/creatures/skullyhop/charge_down-3.png new file mode 100644 index 00000000000..eb9e12bad4e Binary files /dev/null and b/data/images/creatures/skullyhop/charge_down-3.png differ diff --git a/data/images/creatures/skullyhop/charge_left-0.png b/data/images/creatures/skullyhop/charge_left-0.png new file mode 100644 index 00000000000..b7e06fca76b Binary files /dev/null and b/data/images/creatures/skullyhop/charge_left-0.png differ diff --git a/data/images/creatures/skullyhop/charge_left-1.png b/data/images/creatures/skullyhop/charge_left-1.png new file mode 100644 index 00000000000..9370ab19a82 Binary files /dev/null and b/data/images/creatures/skullyhop/charge_left-1.png differ diff --git a/data/images/creatures/skullyhop/charge_left-2.png b/data/images/creatures/skullyhop/charge_left-2.png new file mode 100644 index 00000000000..a4b8cba4f2b Binary files /dev/null and b/data/images/creatures/skullyhop/charge_left-2.png differ diff --git a/data/images/creatures/skullyhop/charge_left-3.png b/data/images/creatures/skullyhop/charge_left-3.png new file mode 100644 index 00000000000..03cd491b8bf Binary files /dev/null and b/data/images/creatures/skullyhop/charge_left-3.png differ diff --git a/data/images/creatures/skullyhop/dart_light.png b/data/images/creatures/skullyhop/dart_light.png new file mode 100644 index 00000000000..8f3d852d064 Binary files /dev/null and b/data/images/creatures/skullyhop/dart_light.png differ diff --git a/data/images/creatures/darttrap/darttrap.sprite b/data/images/creatures/skullyhop/darttrap.sprite similarity index 100% rename from data/images/creatures/darttrap/darttrap.sprite rename to data/images/creatures/skullyhop/darttrap.sprite diff --git a/data/images/creatures/skullyhop/empty_down-0.png b/data/images/creatures/skullyhop/empty_down-0.png new file mode 100644 index 00000000000..7a23ec7967d Binary files /dev/null and b/data/images/creatures/skullyhop/empty_down-0.png differ diff --git a/data/images/creatures/skullyhop/empty_down-1.png b/data/images/creatures/skullyhop/empty_down-1.png new file mode 100644 index 00000000000..f98d38f913e Binary files /dev/null and b/data/images/creatures/skullyhop/empty_down-1.png differ diff --git a/data/images/creatures/skullyhop/empty_down-2.png b/data/images/creatures/skullyhop/empty_down-2.png new file mode 100644 index 00000000000..e36a4646f88 Binary files /dev/null and b/data/images/creatures/skullyhop/empty_down-2.png differ diff --git a/data/images/creatures/skullyhop/empty_down-3.png b/data/images/creatures/skullyhop/empty_down-3.png new file mode 100644 index 00000000000..9a47febad43 Binary files /dev/null and b/data/images/creatures/skullyhop/empty_down-3.png differ diff --git a/data/images/creatures/skullyhop/empty_down-4.png b/data/images/creatures/skullyhop/empty_down-4.png new file mode 100644 index 00000000000..ea977d9086b Binary files /dev/null and b/data/images/creatures/skullyhop/empty_down-4.png differ diff --git a/data/images/creatures/skullyhop/empty_left-0.png b/data/images/creatures/skullyhop/empty_left-0.png new file mode 100644 index 00000000000..80c4c7d596d Binary files /dev/null and b/data/images/creatures/skullyhop/empty_left-0.png differ diff --git a/data/images/creatures/skullyhop/empty_left-1.png b/data/images/creatures/skullyhop/empty_left-1.png new file mode 100644 index 00000000000..c432584da67 Binary files /dev/null and b/data/images/creatures/skullyhop/empty_left-1.png differ diff --git a/data/images/creatures/skullyhop/empty_left-2.png b/data/images/creatures/skullyhop/empty_left-2.png new file mode 100644 index 00000000000..c3e9e629f5a Binary files /dev/null and b/data/images/creatures/skullyhop/empty_left-2.png differ diff --git a/data/images/creatures/skullyhop/empty_left-3.png b/data/images/creatures/skullyhop/empty_left-3.png new file mode 100644 index 00000000000..3b0e796343d Binary files /dev/null and b/data/images/creatures/skullyhop/empty_left-3.png differ diff --git a/data/images/creatures/skullyhop/empty_left-4.png b/data/images/creatures/skullyhop/empty_left-4.png new file mode 100644 index 00000000000..afd75806415 Binary files /dev/null and b/data/images/creatures/skullyhop/empty_left-4.png differ diff --git a/data/images/creatures/skullyhop/skull_dart.sprite b/data/images/creatures/skullyhop/skull_dart.sprite new file mode 100644 index 00000000000..ffae418de3d --- /dev/null +++ b/data/images/creatures/skullyhop/skull_dart.sprite @@ -0,0 +1,22 @@ +(supertux-sprite + (action + (name "flying-left") + (hitbox 6 12 22 9) + (images "skull_dart_left.png") + ) + (action + (name "flying-right") + (hitbox 4 12 22 9) + (mirror-action "flying-left") + ) + (action + (name "flying-down") + (hitbox 12 4 9 22) + (images "skull_dart_down.png") + ) + (action + (name "flying-up") + (hitbox 12 6 9 22) + (flip-action "flying-down") + ) +) \ No newline at end of file diff --git a/data/images/creatures/skullyhop/skull_dart_down.png b/data/images/creatures/skullyhop/skull_dart_down.png new file mode 100644 index 00000000000..655016d2770 Binary files /dev/null and b/data/images/creatures/skullyhop/skull_dart_down.png differ diff --git a/data/images/creatures/skullyhop/skull_dart_left.png b/data/images/creatures/skullyhop/skull_dart_left.png new file mode 100644 index 00000000000..1fa3580ff3e Binary files /dev/null and b/data/images/creatures/skullyhop/skull_dart_left.png differ diff --git a/data/images/engine/editor/objects.stoi b/data/images/engine/editor/objects.stoi index 6c9cb9b9370..c71722b3729 100644 --- a/data/images/engine/editor/objects.stoi +++ b/data/images/engine/editor/objects.stoi @@ -97,11 +97,14 @@ (class "zeekling") (icon "images/creatures/zeekling/zeekling-0.png")) (object - (class "skullyhop") - (icon "images/creatures/skullyhop/stand-0.png")) + (class "corrupted_granito") + (icon "images/creatures/granito/corrupted/idle_left-0.png")) + (object + (class "corrupted_granito_big") + (icon "images/creatures/granito/corrupted/big/rock_mine-0.png")) (object (class "darttrap") - (icon "images/creatures/darttrap/charge_left-1.png")) + (icon "images/creatures/darttrap/granito/empty_left.png")) (object (class "ghoul") (icon "images/creatures/ghoul/g1.png")) @@ -180,7 +183,7 @@ (icon "images/engine/editor/stalactite_ice_yeti.png")) (object (class "dart") - (icon "images/creatures/darttrap/skull_dart_left.png")) + (icon "images/creatures/darttrap/granito/root_dart_left.png")) ) (objectgroup diff --git a/data/images/particles/granito_piece-0.png b/data/images/particles/granito_piece-0.png new file mode 100644 index 00000000000..dfbc64cf577 Binary files /dev/null and b/data/images/particles/granito_piece-0.png differ diff --git a/data/images/particles/granito_piece-1.png b/data/images/particles/granito_piece-1.png new file mode 100644 index 00000000000..642bd2454c5 Binary files /dev/null and b/data/images/particles/granito_piece-1.png differ diff --git a/data/images/particles/granito_piece-2.png b/data/images/particles/granito_piece-2.png new file mode 100644 index 00000000000..1b2341fc9af Binary files /dev/null and b/data/images/particles/granito_piece-2.png differ diff --git a/data/images/particles/granito_piece-3.png b/data/images/particles/granito_piece-3.png new file mode 100644 index 00000000000..01afb84de8f Binary files /dev/null and b/data/images/particles/granito_piece-3.png differ diff --git a/data/images/particles/granito_piece-4.png b/data/images/particles/granito_piece-4.png new file mode 100644 index 00000000000..a8b96caddef Binary files /dev/null and b/data/images/particles/granito_piece-4.png differ diff --git a/data/images/particles/granito_piece-5.png b/data/images/particles/granito_piece-5.png new file mode 100644 index 00000000000..d2e3ac15edd Binary files /dev/null and b/data/images/particles/granito_piece-5.png differ diff --git a/data/images/particles/granito_piece.sprite b/data/images/particles/granito_piece.sprite new file mode 100644 index 00000000000..8ad12150051 --- /dev/null +++ b/data/images/particles/granito_piece.sprite @@ -0,0 +1,48 @@ +(supertux-sprite + (action + (name "piece-0") + (hitbox 0 0 22 22) + (images + "granito_piece-0.png" + ) + ) + + (action + (name "piece-1") + (hitbox 0 0 12 12) + (images + "granito_piece-1.png" + ) + ) + + (action + (name "piece-2") + (hitbox 0 0 18 18) + (images + "granito_piece-2.png" + ) + ) + + (action + (name "piece-3") + (hitbox 0 0 22 22) + (images + "granito_piece-3.png" + ) + ) + + (action + (name "piece-4") + (hitbox 0 0 10 10) + (images + "granito_piece-4.png" + ) + ) + (action + (name "piece-5") + (hitbox 0 0 12 12) + (images + "granito_piece-5.png" + ) + ) +) diff --git a/src/badguy/skullyhop.cpp b/src/badguy/corrupted_granito.cpp similarity index 54% rename from src/badguy/skullyhop.cpp rename to src/badguy/corrupted_granito.cpp index e4a196b7e5a..b44f4ee7c4b 100644 --- a/src/badguy/skullyhop.cpp +++ b/src/badguy/corrupted_granito.cpp @@ -1,5 +1,6 @@ -// SkullyHop - A Hopping Skull +// SuperTux - Corrupted Granito - An "Evil" Granito // Copyright (C) 2006 Christoph Sommer +// 2023 MatusGuy // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -14,27 +15,27 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "badguy/skullyhop.hpp" +#include "badguy/corrupted_granito.hpp" #include "audio/sound_manager.hpp" #include "sprite/sprite.hpp" -namespace { -const std::string SKULLYHOP_SOUND = "sounds/hop.ogg"; -const float HORIZONTAL_SPEED = 220; /**< X-speed when jumping. */ -const float VERTICAL_SPEED = -450; /**< Y-speed when jumping. */ -} +static const std::string CORRUPTED_GRANITO_SOUND = "sounds/hop.ogg"; +static const float HORIZONTAL_SPEED = 220; /**< X-speed when jumping. */ +static const float VERTICAL_SPEED = -450; /**< Y-speed when jumping. */ -SkullyHop::SkullyHop(const ReaderMapping& reader) : - BadGuy(reader, "images/creatures/skullyhop/skullyhop.sprite"), +CorruptedGranito::CorruptedGranito(const ReaderMapping& reader) : + BadGuy(reader, "images/creatures/granito/corrupted/corrupted_granito.sprite"), recover_timer(), state() { - SoundManager::current()->preload( SKULLYHOP_SOUND ); + parse_type(reader); + + SoundManager::current()->preload(CORRUPTED_GRANITO_SOUND); } void -SkullyHop::initialize() +CorruptedGranito::initialize() { // The initial state is JUMPING, because we might start airborne. state = JUMPING; @@ -42,29 +43,35 @@ SkullyHop::initialize() } void -SkullyHop::set_state(SkullyHopState newState) +CorruptedGranito::set_state(CorruptedGranitoState newState) { - if (newState == STANDING) { + if (newState == STANDING) + { m_physic.set_velocity(0, 0); set_action("standing", m_dir); recover_timer.start(0.5); - } else - if (newState == CHARGING) { + } + else + { + if (newState == CHARGING) + { set_action("charging", m_dir, 1); - } else - if (newState == JUMPING) { - set_action("jumping", m_dir); - m_physic.set_velocity_x(m_dir == Direction::LEFT ? -HORIZONTAL_SPEED : HORIZONTAL_SPEED); - m_physic.set_velocity_y(VERTICAL_SPEED); - SoundManager::current()->play( SKULLYHOP_SOUND, get_pos()); - } + } + else if (newState == JUMPING) + { + set_action("jumping", m_dir); + m_physic.set_velocity_x(m_dir == Direction::LEFT ? -HORIZONTAL_SPEED : HORIZONTAL_SPEED); + m_physic.set_velocity_y(VERTICAL_SPEED); + SoundManager::current()->play( CORRUPTED_GRANITO_SOUND, get_pos()); + } + } state = newState; } bool -SkullyHop::collision_squished(GameObject& object) +CorruptedGranito::collision_squished(GameObject& object) { if (m_frozen) return BadGuy::collision_squished(object); @@ -75,7 +82,7 @@ SkullyHop::collision_squished(GameObject& object) } void -SkullyHop::collision_solid(const CollisionHit& hit) +CorruptedGranito::collision_solid(const CollisionHit& hit) { if (m_frozen || BadGuy::get_state() == STATE_BURNING) { @@ -84,25 +91,24 @@ SkullyHop::collision_solid(const CollisionHit& hit) } // Default behaviour (i.e. stop at floor/walls) when squished. - if (BadGuy::get_state() == STATE_SQUISHED) { + if (BadGuy::get_state() == STATE_SQUISHED) BadGuy::collision_solid(hit); - } // Ignore collisions while standing still. if (state != JUMPING) return; // Check if we hit the floor while falling. - if (hit.bottom && m_physic.get_velocity_y() > 0 ) { + if (hit.bottom && m_physic.get_velocity_y() > 0) set_state(STANDING); - } + // Check if we hit the roof while climbing. - if (hit.top) { + if (hit.top) m_physic.set_velocity_y(0); - } // Check if we hit left or right while moving in either direction. - if (hit.left || hit.right) { + if (hit.left || hit.right) + { m_dir = m_dir == Direction::LEFT ? Direction::RIGHT : Direction::LEFT; set_action("jumping", m_dir); m_physic.set_velocity_x(-0.25f*m_physic.get_velocity_x()); @@ -110,7 +116,7 @@ SkullyHop::collision_solid(const CollisionHit& hit) } HitResponse -SkullyHop::collision_badguy(BadGuy& , const CollisionHit& hit) +CorruptedGranito::collision_badguy(BadGuy& , const CollisionHit& hit) { // Behaviour for badguy collisions is the same as for collisions with solids. collision_solid(hit); @@ -119,7 +125,7 @@ SkullyHop::collision_badguy(BadGuy& , const CollisionHit& hit) } void -SkullyHop::active_update(float dt_sec) +CorruptedGranito::active_update(float dt_sec) { BadGuy::active_update(dt_sec); @@ -128,29 +134,53 @@ SkullyHop::active_update(float dt_sec) return; // Charge when fully recovered. - if ((state == STANDING) && (recover_timer.check())) { + if (state == STANDING && recover_timer.check()) + { set_state(CHARGING); return; } // Jump as soon as charging animation completed. - if ((state == CHARGING) && (m_sprite->animation_done())) { + if (state == CHARGING && m_sprite->animation_done()) + { set_state(JUMPING); return; } } void -SkullyHop::unfreeze(bool melt) +CorruptedGranito::unfreeze(bool melt) { BadGuy::unfreeze(melt); initialize(); } bool -SkullyHop::is_freezable() const +CorruptedGranito::is_freezable() const { - return true; + return m_type != GRANITO; +} + +GameObjectTypes +CorruptedGranito::get_types() const +{ + return { + { "granito", _("Granito") }, + { "skullyhop", _("Skullyhop") } + }; +} + +std::string +CorruptedGranito::get_default_sprite_name() const +{ + switch (m_type) + { + case GRANITO: + return "images/creatures/granito/corrupted/corrupted_granito.sprite"; + case SKULLYHOP: + return "images/creatures/skullyhop/skullyhop.sprite"; + } + return "images/creatures/granito/corrupted/corrupted_granito.sprite"; } /* EOF */ diff --git a/src/badguy/skullyhop.hpp b/src/badguy/corrupted_granito.hpp similarity index 63% rename from src/badguy/skullyhop.hpp rename to src/badguy/corrupted_granito.hpp index d2516a960b1..7c1e0c7e57f 100644 --- a/src/badguy/skullyhop.hpp +++ b/src/badguy/corrupted_granito.hpp @@ -1,4 +1,4 @@ -// SkullyHop - A Hopping Skull +// SuperTux - Corrupted Granito - An "Evil" Granito // Copyright (C) 2006 Christoph Sommer // // This program is free software: you can redistribute it and/or modify @@ -14,16 +14,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#ifndef HEADER_SUPERTUX_BADGUY_SKULLYHOP_HPP -#define HEADER_SUPERTUX_BADGUY_SKULLYHOP_HPP +#ifndef HEADER_SUPERTUX_BADGUY_CORRUPTEDGRANITO_HPP +#define HEADER_SUPERTUX_BADGUY_CORRUPTEDGRANITO_HPP #include "badguy/badguy.hpp" -/** Badguy "SkullyHop" - A Hopping Skull */ -class SkullyHop final : public BadGuy +/** An "Evil" Granito. */ +class CorruptedGranito final : public BadGuy { public: - SkullyHop(const ReaderMapping& reader); + enum Type { + GRANITO, SKULLYHOP + }; + +public: + CorruptedGranito(const ReaderMapping& reader); virtual void initialize() override; virtual void collision_solid(const CollisionHit& hit) override; @@ -33,29 +38,34 @@ class SkullyHop final : public BadGuy virtual void unfreeze(bool melt = true) override; virtual bool is_freezable() const override; - static std::string class_name() { return "skullyhop"; } + static std::string class_name() { return "corrupted_granito"; } virtual std::string get_class_name() const override { return class_name(); } - static std::string display_name() { return _("Skullyhop"); } + static std::string display_name() { return _("Corrupted Granito"); } virtual std::string get_display_name() const override { return display_name(); } virtual bool is_snipable() const override { return true; } + virtual bool is_flammable() const override { return false; } + + virtual GameObjectTypes get_types() const override; + virtual std::string get_default_sprite_name() const override; private: - enum SkullyHopState { + + enum CorruptedGranitoState { STANDING, CHARGING, JUMPING }; private: - void set_state(SkullyHopState newState); + void set_state(CorruptedGranitoState newState); private: Timer recover_timer; - SkullyHopState state; + CorruptedGranitoState state; private: - SkullyHop(const SkullyHop&) = delete; - SkullyHop& operator=(const SkullyHop&) = delete; + CorruptedGranito(const CorruptedGranito&) = delete; + CorruptedGranito& operator=(const CorruptedGranito&) = delete; }; #endif diff --git a/src/badguy/corrupted_granito_big.cpp b/src/badguy/corrupted_granito_big.cpp new file mode 100644 index 00000000000..3c4a2a4f197 --- /dev/null +++ b/src/badguy/corrupted_granito_big.cpp @@ -0,0 +1,171 @@ +// SuperTux +// Copyright (C) 2023 MatusGuy +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "badguy/corrupted_granito_big.hpp" + +#include "audio/sound_manager.hpp" +#include "collision/collision_system.hpp" +#include "math/random.hpp" +#include "object/player.hpp" +#include "object/shard.hpp" +#include "object/sprite_particle.hpp" +#include "sprite/sprite_manager.hpp" +#include "supertux/sector.hpp" + +static const std::string SHARD_SPRITE = "images/creatures/granito/corrupted/big/root_spike.sprite"; +static const float RANGE = 5; // tiles +static const float CRACK_TIME = 1.f; // seconds +static const float SHAKE_TIME = 0.1f; // seconds + +CorruptedGranitoBig::CorruptedGranitoBig(const ReaderMapping& reader) : + BadGuy(reader, "images/creatures/granito/corrupted/big/rock_mine.sprite", LAYER_OBJECTS-3), + m_state(STATE_READY), + m_crack_timer(), + m_shake_timer(), + m_shake_delta(0.f), + m_rock_particles(SpriteManager::current()->create("images/particles/granito_piece.sprite")) +{ + parse_type(reader); + + m_col.set_unisolid(true); + + SoundManager::current()->preload("sounds/brick.wav"); +} + +void +CorruptedGranitoBig::initialize() +{ + BadGuy::initialize(); + + m_state = STATE_READY; + set_action("idle", m_dir); + set_colgroup_active(COLGROUP_MOVING_STATIC); +} + +void +CorruptedGranitoBig::active_update(float dt_sec) +{ + BadGuy::active_update(dt_sec); + + if (m_state == STATE_BROKEN) return; + + const bool crack = try_cracking(); + if (!crack && !m_crack_timer.paused() && m_crack_timer.started()) m_crack_timer.pause(); + + if (m_shake_timer.started()) + m_shake_delta = static_cast(graphicsRandom.rand(-3, 3)); + else + m_shake_delta = 0.f; +} + +void +CorruptedGranitoBig::draw(DrawingContext &context) +{ + m_sprite->draw(context.color(), {get_pos().x + m_shake_delta, get_pos().y}, m_layer, m_flip); +} + +void +CorruptedGranitoBig::kill_fall() +{ + m_state = STATE_BROKEN; + set_action("broken", m_dir); + set_colgroup_active(COLGROUP_MOVING_ONLY_STATIC); + m_col.set_unisolid(false); + + run_dead_script(); + + Sector::get().add(get_bbox().get_middle(), Vector(100.f, -500.f), SHARD_SPRITE); + Sector::get().add(get_bbox().get_middle(), Vector(270.f, -350.f), SHARD_SPRITE); + Sector::get().add(get_bbox().get_middle(), Vector(-100.f, -500.f),SHARD_SPRITE); + Sector::get().add(get_bbox().get_middle(), Vector(-270.f, -350.f),SHARD_SPRITE); + + crack_effects(6); +} + +bool +CorruptedGranitoBig::try_cracking() +{ + using RaycastResult = CollisionSystem::RaycastResult; + + Player* player = get_nearest_player(); + if (!player) return false; + + const Vector middle = get_bbox().get_middle(); + const Vector player_middle = player->get_bbox().get_middle(); + + RaycastResult result = Sector::get().get_first_line_intersection(middle, player_middle, + false, get_collision_object()); + + auto* obj = std::get_if(&result.hit); + if (!obj || *obj != player->get_collision_object()) return false; + + if (glm::distance(middle, player_middle) > 32.f * RANGE) return false; + + crack(); + return true; +} + +void +CorruptedGranitoBig::crack() +{ + if (m_state == STATE_CRACK2 && m_crack_timer.check()) + { + kill_fall(); + return; + } + + if (m_crack_timer.paused()) + m_crack_timer.resume(); + else if (!m_crack_timer.started()) + m_crack_timer.start(CRACK_TIME); + + float progress = m_crack_timer.get_timegone() / m_crack_timer.get_period(); + + if (m_state == STATE_CRACK1 && progress >= 0.5f) + { + m_state = STATE_CRACK2; + set_action("cracked-2", m_dir); + crack_effects(4); + } + else if (m_state == STATE_READY) + { + m_state = STATE_CRACK1; + set_action("cracked-1", m_dir); + crack_effects(3); + } +} + +void +CorruptedGranitoBig::crack_effects(int particles) +{ + assert(particles > 0 && particles <= 6); + + SoundManager::current()->play("sounds/brick.wav", get_pos()); + m_shake_timer.start(SHAKE_TIME); + + const float gravity = Sector::get().get_gravity() * 100.f; + for (int i = 0; i < particles; i++) + { + const Vector velocity(graphicsRandom.randf(-100, 100), + graphicsRandom.randf(-400, -300)); + Sector::get().add(m_rock_particles->clone(), "piece-" + std::to_string(i), + get_bbox().get_middle(), ANCHOR_MIDDLE, + velocity, Vector(0, gravity), + LAYER_OBJECTS + 3, true); + } +} + +/* EOF */ diff --git a/src/badguy/corrupted_granito_big.hpp b/src/badguy/corrupted_granito_big.hpp new file mode 100644 index 00000000000..e007e35d8a4 --- /dev/null +++ b/src/badguy/corrupted_granito_big.hpp @@ -0,0 +1,71 @@ +// SuperTux +// Copyright (C) 2023 MatusGuy +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#ifndef HEADER_SUPERTUX_BADGUY_CORRUPTED_GRANITO_BIG_HPP +#define HEADER_SUPERTUX_BADGUY_CORRUPTED_GRANITO_BIG_HPP + +#include "badguy/badguy.hpp" + +/** Granito, which explodes into shards when player comes close to it. */ +class CorruptedGranitoBig final : public BadGuy +{ +public: + explicit CorruptedGranitoBig(const ReaderMapping& reader); + + virtual void initialize() override; + virtual void active_update(float dt_sec) override; + virtual void draw(DrawingContext& context) override; + virtual void kill_fall() override; + + static std::string class_name() { return "corrupted_granito_big"; } + virtual std::string get_class_name() const override { return class_name(); } + static std::string display_name() { return _("Corrupted Big Granito"); } + virtual std::string get_display_name() const override { return display_name(); } + + virtual bool is_snipable() const override { return false; } + virtual bool is_freezable() const override { return false; } + virtual bool is_flammable() const override { return false; } + +private: + bool try_cracking(); + void crack(); + void crack_effects(int particles); + +private: + enum State + { + STATE_READY, + STATE_CRACK1, + STATE_CRACK2, + STATE_BROKEN + }; + + State m_state; + Timer m_crack_timer; + + Timer m_shake_timer; + float m_shake_delta; + + SpritePtr m_rock_particles; + +private: + CorruptedGranitoBig(const CorruptedGranitoBig&) = delete; + CorruptedGranitoBig& operator=(const CorruptedGranitoBig&) = delete; +}; + +#endif + +/* EOF */ diff --git a/src/badguy/dart.cpp b/src/badguy/dart.cpp index c694312dcab..9b4fc77b424 100644 --- a/src/badguy/dart.cpp +++ b/src/badguy/dart.cpp @@ -1,4 +1,4 @@ -// Dart - Your average poison dart +// Dart - Sharp projectile commonly shot from DartTrap // Copyright (C) 2006 Christoph Sommer // // This program is free software: you can redistribute it and/or modify @@ -28,7 +28,7 @@ const float DART_SPEED = 200; static const std::string DART_SOUND = "sounds/flame.wav"; Dart::Dart(const ReaderMapping& reader) : - BadGuy(reader, "images/creatures/darttrap/skull_dart.sprite"), + BadGuy(reader, "images/creatures/darttrap/granito/root_dart.sprite"), parent(nullptr), sound_source() { diff --git a/src/badguy/dart.hpp b/src/badguy/dart.hpp index c9cbf317e2e..ae3ba35d909 100644 --- a/src/badguy/dart.hpp +++ b/src/badguy/dart.hpp @@ -1,4 +1,4 @@ -// Dart - Your average poison dart +// Dart - Sharp projectile commonly shot from DartTrap // Copyright (C) 2006 Christoph Sommer // // This program is free software: you can redistribute it and/or modify @@ -21,12 +21,12 @@ class SoundSource; -/** Badguy "Dart" - Your average poison dart */ +/** Badguy "Dart" - Sharp projectile commonly shot from DartTrap */ class Dart final : public BadGuy { public: Dart(const ReaderMapping& reader); - Dart(const Vector& pos, Direction d, const BadGuy* parent, const std::string& sprite = "images/creatures/dart/dart.sprite"); + Dart(const Vector& pos, Direction d, const BadGuy* parent, const std::string& sprite = "images/creatures/darttrap/granito/root_dart.sprite"); virtual void initialize() override; virtual void activate() override; diff --git a/src/badguy/darttrap.cpp b/src/badguy/darttrap.cpp index 4dfcbd557bb..70d6a5c0d67 100644 --- a/src/badguy/darttrap.cpp +++ b/src/badguy/darttrap.cpp @@ -27,20 +27,23 @@ #include "util/reader_mapping.hpp" DartTrap::DartTrap(const ReaderMapping& reader) : - BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", get_allowed_directions()[0], LAYER_TILES-1), + BadGuy(reader, "images/creatures/darttrap/granito/darttrap_granito.sprite", get_allowed_directions()[0], LAYER_TILES-1), m_enabled(true), m_initial_delay(), m_fire_delay(), m_ammo(), - m_dart_sprite("images/creatures/dart/dart.sprite"), + m_dart_sprite("images/creatures/darttrap/granito/root_dart.sprite"), m_state(IDLE), m_fire_timer() { + parse_type(reader); + reader.get("enabled", m_enabled, true); reader.get("initial-delay", m_initial_delay, 0.0f); reader.get("fire-delay", m_fire_delay, 2.0f); reader.get("ammo", m_ammo, -1); - reader.get("dart-sprite", m_dart_sprite, "images/creatures/darttrap/skull_dart.sprite"); + reader.get("dart-sprite", m_dart_sprite, "images/creatures/darttrap/granito/root_dart.sprite"); + m_countMe = false; SoundManager::current()->preload("sounds/dartfire.wav"); if (m_start_dir == Direction::AUTO) { log_warning << "Setting a DartTrap's direction to AUTO is no good idea" << std::endl; } @@ -146,13 +149,35 @@ DartTrap::get_settings() result.add_bool(_("Enabled"), &m_enabled, "enabled", true); result.add_float(_("Fire delay"), &m_fire_delay, "fire-delay"); result.add_int(_("Ammo"), &m_ammo, "ammo"); - result.add_sprite(_("Dart sprite"), &m_dart_sprite, "dart-sprite", "images/creatures/darttrap/skull_dart.sprite"); + result.add_sprite(_("Dart sprite"), &m_dart_sprite, "dart-sprite", "images/creatures/darttrap/granito/root_dart.sprite"); result.reorder({"initial-delay", "fire-delay", "ammo", "direction", "x", "y", "dart-sprite"}); return result; } +GameObjectTypes +DartTrap::get_types() const +{ + return { + {"granito", _("Granito")}, + {"skull", _("Skull")} + }; +} + +std::string +DartTrap::get_default_sprite_name() const +{ + switch (m_type) + { + case SKULL: + return "images/creatures/darttrap/skull/darttrap_skull.sprite"; + case GRANITO: + return "images/creatures/darttrap/granito/darttrap_granito.sprite"; + } + return "images/creatures/darttrap/granito/darttrap_granito.sprite"; +} + std::vector DartTrap::get_allowed_directions() const { @@ -174,7 +199,25 @@ DartTrap::on_flip(float height) set_action(m_state == IDLE ? "idle" : "loading", m_dir, 1); } else + { FlipLevelTransformer::transform_flip(m_flip); + } +} + +void +DartTrap::on_type_change(int old_type) +{ + BadGuy::on_type_change(old_type); + + switch (m_type) + { + case GRANITO: + m_dart_sprite = "images/creatures/darttrap/granito/root_dart.sprite"; + break; + case SKULL: + m_dart_sprite = "images/creatures/darttrap/skull/skull_dart.sprite"; + break; + } } /* EOF */ diff --git a/src/badguy/darttrap.hpp b/src/badguy/darttrap.hpp index 43cbb7ce7fd..8988ebbe3ee 100644 --- a/src/badguy/darttrap.hpp +++ b/src/badguy/darttrap.hpp @@ -36,8 +36,11 @@ class DartTrap final : public BadGuy virtual std::string get_display_name() const override { return display_name(); } virtual ObjectSettings get_settings() override; + virtual GameObjectTypes get_types() const override; + virtual std::string get_default_sprite_name() const override; virtual void on_flip(float height) override; + virtual void on_type_change(int old_type) override; protected: virtual std::vector get_allowed_directions() const override; @@ -47,6 +50,10 @@ class DartTrap final : public BadGuy IDLE, LOADING }; + enum Type { + GRANITO, SKULL + }; + void load(); void fire(); diff --git a/src/badguy/dispenser.cpp b/src/badguy/dispenser.cpp index d95c8b1d692..f54f35dcc74 100644 --- a/src/badguy/dispenser.cpp +++ b/src/badguy/dispenser.cpp @@ -29,7 +29,7 @@ #include "util/reader_mapping.hpp" Dispenser::Dispenser(const ReaderMapping& reader) : - BadGuy(reader, "images/creatures/dispenser/dropper.sprite"), + BadGuy(reader, "images/creatures/dispenser/dropper.sprite", LAYER_OBJECTS + 5), ExposedObject(this), m_cycle(), m_objects(), @@ -219,6 +219,7 @@ Dispenser::launch_object() switch (m_type) { + case DispenserType::GRANITO: case DispenserType::DROPPER: if (m_flip == NO_FLIP) { @@ -281,7 +282,7 @@ Dispenser::launch_object() void Dispenser::freeze() { - if (m_type == DispenserType::POINT) + if (m_type == DispenserType::POINT || m_type == DispenserType::GRANITO) return; set_group(COLGROUP_MOVING_STATIC); @@ -363,7 +364,15 @@ Dispenser::set_correct_action() void Dispenser::on_type_change(int old_type) { - MovingSprite::on_type_change(); + MovingSprite::on_type_change(old_type); + + if (old_type == GRANITO || m_type == GRANITO) + { + m_objects.clear(); + if (m_type == GRANITO) // Switching to type GRANITO + add_object(GameObjectFactory::instance().create("corrupted_granito")); + } + set_correct_action(); } @@ -374,7 +383,10 @@ Dispenser::get_settings() result.add_float(_("Interval (seconds)"), &m_cycle, "cycle"); result.add_bool(_("Random"), &m_random, "random", false); - result.add_objects(_("Objects"), &m_objects, this, "objects"); + if (m_type != GRANITO) + { + result.add_objects(_("Objects"), &m_objects, this, "objects"); + } result.add_bool(_("Limit dispensed badguys"), &m_limit_dispensed_badguys, "limit-dispensed-badguys", false); result.add_bool(_("Obey Gravity"), &m_gravity, @@ -391,9 +403,10 @@ GameObjectTypes Dispenser::get_types() const { return { - { "dropper", _("dropper") }, - { "cannon", _("cannon") }, - { "point", _("invisible") } + { "dropper", _("Dropper") }, + { "cannon", _("Cannon") }, + { "point", _("Invisible") }, + { "granito", _("Granito") } }; } @@ -404,6 +417,8 @@ Dispenser::get_default_sprite_name() const { case POINT: return "images/creatures/dispenser/invisible.sprite"; + case GRANITO: + return "images/creatures/granito/corrupted/hive/granito_hive.sprite"; default: return "images/creatures/dispenser/" + type_value_to_id(m_type) + ".sprite"; } diff --git a/src/badguy/dispenser.hpp b/src/badguy/dispenser.hpp index 9542d4cef6e..e5ffd849b73 100644 --- a/src/badguy/dispenser.hpp +++ b/src/badguy/dispenser.hpp @@ -28,7 +28,7 @@ class Dispenser final : public BadGuy, { private: enum DispenserType { - DROPPER, CANNON, POINT + DROPPER, CANNON, POINT, GRANITO }; public: diff --git a/src/object/shard.cpp b/src/object/shard.cpp index 228c31dda61..b9932269732 100644 --- a/src/object/shard.cpp +++ b/src/object/shard.cpp @@ -32,8 +32,8 @@ Shard::Shard(const ReaderMapping& reader) : SoundManager::current()->preload("sounds/crystallo-shardhit.ogg"); } -Shard::Shard(const Vector& pos, const Vector& velocity) : - MovingSprite(pos, "images/creatures/crystallo/shard.sprite", LAYER_TILES - 2, COLGROUP_MOVING), +Shard::Shard(const Vector& pos, const Vector& velocity, const std::string& sprite) : + MovingSprite(pos, sprite, LAYER_TILES - 2, COLGROUP_MOVING), m_physic(), m_stick_timer() { diff --git a/src/object/shard.hpp b/src/object/shard.hpp index d2c3feff188..d642cc7d364 100644 --- a/src/object/shard.hpp +++ b/src/object/shard.hpp @@ -25,7 +25,7 @@ class Shard final : public MovingSprite { public: Shard(const ReaderMapping& reader); - Shard(const Vector& pos, const Vector& velocity); + Shard(const Vector& pos, const Vector& velocity, const std::string& sprite = "images/creatures/crystallo/shard.sprite"); virtual void update(float dt_sec) override; virtual void collision_solid(const CollisionHit& hit) override; diff --git a/src/supertux/game_object_factory.cpp b/src/supertux/game_object_factory.cpp index 26d3905df17..3e49d90f2fc 100644 --- a/src/supertux/game_object_factory.cpp +++ b/src/supertux/game_object_factory.cpp @@ -20,6 +20,8 @@ #include "badguy/angrystone.hpp" #include "badguy/bouncing_snowball.hpp" #include "badguy/captainsnowball.hpp" +#include "badguy/corrupted_granito.hpp" +#include "badguy/corrupted_granito_big.hpp" #include "badguy/crusher.hpp" #include "badguy/crystallo.hpp" #include "badguy/dart.hpp" @@ -49,7 +51,6 @@ #include "badguy/plant.hpp" #include "badguy/rcrystallo.hpp" #include "badguy/short_fuse.hpp" -#include "badguy/skullyhop.hpp" #include "badguy/skydive.hpp" #include "badguy/smartball.hpp" #include "badguy/smartblock.hpp" @@ -165,8 +166,11 @@ GameObjectFactory::init_factories() add_factory("angrystone"); add_factory("bouncingsnowball", OBJ_PARAM_DISPENSABLE); add_factory("captainsnowball", OBJ_PARAM_DISPENSABLE); - add_factory("crusher"); + add_factory("skullyhop"); // backward compatibility + add_factory("corrupted_granito", OBJ_PARAM_DISPENSABLE); + add_factory("corrupted_granito_big", OBJ_PARAM_DISPENSABLE); add_factory("icecrusher"); // backward compatibility + add_factory("crusher"); add_factory("crystallo", OBJ_PARAM_DISPENSABLE); add_factory("dart", OBJ_PARAM_DISPENSABLE); add_factory("darttrap"); @@ -206,7 +210,6 @@ GameObjectFactory::init_factories() add_factory("short_fuse", OBJ_PARAM_DISPENSABLE); add_factory("sspiky", OBJ_PARAM_DISPENSABLE); add_factory("skydive", OBJ_PARAM_PORTABLE | OBJ_PARAM_DISPENSABLE); - add_factory("skullyhop", OBJ_PARAM_DISPENSABLE); add_factory("smartball", OBJ_PARAM_DISPENSABLE); add_factory("smartblock", OBJ_PARAM_PORTABLE | OBJ_PARAM_DISPENSABLE); add_factory("snail", OBJ_PARAM_PORTABLE | OBJ_PARAM_DISPENSABLE); diff --git a/src/supertux/timer.cpp b/src/supertux/timer.cpp index 74971473316..06ebc1aeb2c 100644 --- a/src/supertux/timer.cpp +++ b/src/supertux/timer.cpp @@ -21,6 +21,7 @@ Timer::Timer() : m_period(0), m_cycle_start(0), + m_cycle_pause(0), m_cyclic(false) { } @@ -31,6 +32,7 @@ Timer::start(float period, bool cyclic) m_period = period; m_cyclic = cyclic; m_cycle_start = g_game_time; + m_cycle_pause = 0; } bool @@ -51,4 +53,18 @@ Timer::check() return false; } +void +Timer::pause() +{ + float left = get_timeleft(); + stop(); + m_cycle_pause = left; +} + +void +Timer::resume() +{ + start(m_cycle_pause); +} + /* EOF */ diff --git a/src/supertux/timer.hpp b/src/supertux/timer.hpp index fe4f990ca03..7374b79ba30 100644 --- a/src/supertux/timer.hpp +++ b/src/supertux/timer.hpp @@ -38,15 +38,23 @@ class Timer final /** stop the timer */ void stop() { start(0); } + /** pause the timer */ + void pause(); + + /** resume (unpause) the timer */ + void resume(); + /** returns the period of the timer or 0 if it isn't started */ float get_period() const { return m_period; } float get_timeleft() const{ return m_period - (g_game_time - m_cycle_start); } float get_timegone() const { return g_game_time - m_cycle_start; } - bool started() const { return m_period != 0 && get_timeleft() > 0; } + bool started() const { return (m_period != 0 && get_timeleft() > 0); } + bool paused() const { return m_cycle_pause != 0; } private: float m_period; float m_cycle_start; + float m_cycle_pause; bool m_cyclic; private: