From: LMH Date: Thu, 29 Nov 2012 02:07:12 +0000 (-1000) Subject: New bonus_block contnet: trampolines & rock X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=02a5360458949a8ff99d363d06e62daa4c5c0a78;p=supertux.git New bonus_block contnet: trampolines & rock --- diff --git a/data/images/objects/bonus_block/bonus-porttramp.png b/data/images/objects/bonus_block/bonus-porttramp.png new file mode 100644 index 000000000..5b502bb9d Binary files /dev/null and b/data/images/objects/bonus_block/bonus-porttramp.png differ diff --git a/data/images/objects/bonus_block/bonus-rock.png b/data/images/objects/bonus_block/bonus-rock.png new file mode 100644 index 000000000..57a4baa36 Binary files /dev/null and b/data/images/objects/bonus_block/bonus-rock.png differ diff --git a/data/images/objects/bonus_block/bonus-tramp.png b/data/images/objects/bonus_block/bonus-tramp.png new file mode 100644 index 000000000..b71021e96 Binary files /dev/null and b/data/images/objects/bonus_block/bonus-tramp.png differ diff --git a/data/images/objects/bonus_block/light.xcf b/data/images/objects/bonus_block/light.xcf index 91e54400c..59a63b3c2 100644 Binary files a/data/images/objects/bonus_block/light.xcf and b/data/images/objects/bonus_block/light.xcf differ diff --git a/data/images/objects/lightmap_light/bonusblock_light.png b/data/images/objects/lightmap_light/bonusblock_light.png index e498abd7f..d158c185d 100644 Binary files a/data/images/objects/lightmap_light/bonusblock_light.png and b/data/images/objects/lightmap_light/bonusblock_light.png differ diff --git a/data/images/tiles.strf b/data/images/tiles.strf index afc788f33..c74c5e57d 100644 --- a/data/images/tiles.strf +++ b/data/images/tiles.strf @@ -15,6 +15,75 @@ ;; src/tile.cpp, unisolid is 3 not 2 (supertux-tiles (tile + (id 2946) + (images + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-1.png" + "objects/bonus_block/full-2.png" + "objects/bonus_block/full-3.png" + "objects/bonus_block/full-4.png" + "objects/bonus_block/full-3.png" + "objects/bonus_block/full-2.png" + "objects/bonus_block/full-1.png" + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-0.png" + ) + (solid #t) + (fullbox #t) + (next-tile 84) + (editor-images "objects/bonus_block/bonus-rock.png") + (data 9) + (fps 15) + ) + + (tile + (id 2945) + (images + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-1.png" + "objects/bonus_block/full-2.png" + "objects/bonus_block/full-3.png" + "objects/bonus_block/full-4.png" + "objects/bonus_block/full-3.png" + "objects/bonus_block/full-2.png" + "objects/bonus_block/full-1.png" + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-0.png" + ) + (solid #t) + (fullbox #t) + (next-tile 84) + (editor-images "objects/bonus_block/bonus-porttramp.png") + (data 8) + (fps 15) + ) + + (tile + (id 2944) + (images + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-1.png" + "objects/bonus_block/full-2.png" + "objects/bonus_block/full-3.png" + "objects/bonus_block/full-4.png" + "objects/bonus_block/full-3.png" + "objects/bonus_block/full-2.png" + "objects/bonus_block/full-1.png" + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-0.png" + "objects/bonus_block/full-0.png" + ) + (solid #t) + (fullbox #t) + (next-tile 84) + (editor-images "objects/bonus_block/bonus-tramp.png") + (data 7) + (fps 15) + ) + + (tile (id 2943) (images "objects/bonus_block/full-0.png" @@ -546,7 +615,7 @@ ) (tilegroup (name "Block") - (tiles 27 28 29 47 48 50 49 211 77 51 52 212 78 62 61 213 44 83 84 102 140 103 104 105 112 128 1311 2153 2943) + (tiles 27 28 29 47 48 50 49 211 77 51 52 212 78 62 61 213 44 83 84 102 140 103 104 105 112 128 2943 2944 2945 2946 1311 2153) ) (tilegroup (name "Background") @@ -3846,5 +3915,5 @@ (image "tiles/snow/slope-upper.png" ) ) -;; next-id: 2944 +;; next-id: 2947 ) diff --git a/data/levels/test/bonusblock.stl b/data/levels/test/bonusblock.stl index 4f953a0dd..a3b7b00fd 100755 --- a/data/levels/test/bonusblock.stl +++ b/data/levels/test/bonusblock.stl @@ -22,7 +22,7 @@ 0 0 0 0 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 b/src/object/bonus_block.cpp @@ -28,6 +28,7 @@ #include "object/portable.hpp" #include "object/specialriser.hpp" #include "object/star.hpp" +#include "object/trampoline.hpp" #include "sprite/sprite_manager.hpp" #include "supertux/constants.hpp" #include "supertux/level.hpp" @@ -41,7 +42,7 @@ BonusBlock::BonusBlock(const Vector& pos, int data) : contents(), object(0), hit_counter(1), - lightsprite(Surface::create("/images/objects/lightmap_light/bonusblock_light.png")) + lightsprite() { bbox.set_pos(pos); sprite->set_action("normal"); @@ -51,7 +52,13 @@ BonusBlock::BonusBlock(const Vector& pos, int data) : case 3: contents = CONTENT_STAR; break; case 4: contents = CONTENT_1UP; break; case 5: contents = CONTENT_ICEGROW; break; - case 6: contents = CONTENT_LIGHT; sound_manager->preload("sounds/switch.ogg"); break; + case 6: contents = CONTENT_LIGHT; + sound_manager->preload("sounds/switch.ogg"); + lightsprite=Surface::create("/images/objects/lightmap_light/bonusblock_light.png"); + break; + case 7: contents = CONTENT_TRAMPOLINE; break; + case 8: contents = CONTENT_PORTTRAMPOLINE; break; + case 9: contents = CONTENT_ROCK; break; default: log_warning << "Invalid box contents" << std::endl; contents = CONTENT_COIN; @@ -64,7 +71,7 @@ BonusBlock::BonusBlock(const Reader& lisp) : contents(), object(0), hit_counter(1), - lightsprite(Surface::create("/images/objects/lightmap_light/bonusblock_light.png")) + lightsprite() { Vector pos; @@ -103,6 +110,12 @@ BonusBlock::BonusBlock(const Reader& lisp) : } else if(contentstring == "light") { contents = CONTENT_LIGHT; sound_manager->preload("sounds/switch.ogg"); + } else if(contentstring == "trampoline") { + contents = CONTENT_TRAMPOLINE; + } else if(contentstring == "porttrampoline") { + contents = CONTENT_PORTTRAMPOLINE; + } else if(contentstring == "rock") { + contents = CONTENT_ROCK; } else { log_warning << "Invalid box contents '" << contentstring << "'" << std::endl; } @@ -121,6 +134,8 @@ BonusBlock::BonusBlock(const Reader& lisp) : if(contents == CONTENT_CUSTOM && object == 0) throw std::runtime_error("Need to specify content object for custom block"); + if(contents == CONTENT_LIGHT) + lightsprite = Surface::create("/images/objects/lightmap_light/bonusblock_light.png"); bbox.set_pos(pos); } @@ -257,6 +272,29 @@ BonusBlock::try_open(Player *player) else sprite->set_action("on"); sound_manager->play("sounds/switch.ogg"); + break; + } + case CONTENT_TRAMPOLINE: + { + SpecialRiser* riser = new SpecialRiser(get_pos(), new Trampoline(get_pos(), false)); + sector->add_object(riser); + sound_manager->play("sounds/upgrade.wav"); + break; + } + case CONTENT_PORTTRAMPOLINE: + { + SpecialRiser* riser = new SpecialRiser(get_pos(), new Trampoline(get_pos(), true)); + sector->add_object(riser); + sound_manager->play("sounds/upgrade.wav"); + break; + } + case CONTENT_ROCK: + { + SpecialRiser* riser = new SpecialRiser(get_pos(), + new Rock(get_pos(), "images/objects/rock/rock.sprite")); + sector->add_object(riser); + sound_manager->play("sounds/upgrade.wav"); + break; } } diff --git a/src/object/bonus_block.hpp b/src/object/bonus_block.hpp index f99378593..303835866 100644 --- a/src/object/bonus_block.hpp +++ b/src/object/bonus_block.hpp @@ -38,7 +38,10 @@ public: CONTENT_1UP, CONTENT_CUSTOM, CONTENT_SCRIPT, - CONTENT_LIGHT + CONTENT_LIGHT, + CONTENT_TRAMPOLINE, + CONTENT_PORTTRAMPOLINE, + CONTENT_ROCK }; protected: diff --git a/src/object/trampoline.cpp b/src/object/trampoline.cpp index c93d3497b..199fe1615 100644 --- a/src/object/trampoline.cpp +++ b/src/object/trampoline.cpp @@ -49,6 +49,18 @@ Trampoline::Trampoline(const Reader& lisp) : } } +Trampoline::Trampoline(const Vector& pos, bool port) : + Rock(pos, "images/objects/trampoline/trampoline.sprite"), + portable(port) +{ + sound_manager->preload(TRAMPOLINE_SOUND); + if(!port) { + sprite_name = "images/objects/trampoline/trampoline_fix.sprite"; + sprite = sprite_manager->create(sprite_name); + sprite->set_action("normal"); + } +} + void Trampoline::update(float elapsed_time) { diff --git a/src/object/trampoline.hpp b/src/object/trampoline.hpp index 27cea23cb..9f7fc7778 100644 --- a/src/object/trampoline.hpp +++ b/src/object/trampoline.hpp @@ -26,6 +26,7 @@ class Trampoline : public Rock { public: Trampoline(const Reader& reader); + Trampoline(const Vector& pos, bool port); HitResponse collision(GameObject& other, const CollisionHit& hit); void collision_solid(const CollisionHit& hit);