-;; Generated by Flexlay Editor
(supertux-level
(version 2)
- (name "Bonus Block Test")
+ (name (_ "Bonus Block Test"))
(author "SuperTux Team")
- (time 999)
(sector
- (name "main")
- (gravity 10.000000)
- (background (image "images/background/arctis.jpg")
- (speed 0.5))
- (spawnpoint (name "main") (x 150) (y 100))
- (rock (x 50) (y 50))
- (rock (x 50) (y 100))
- ;(rock (x 50) (y 150))
+ (name "main")
+ (background
+ (speed 0.5)
+ (image "images/background/arctis.jpg")
+ )
(tilemap
(z-pos -100)
(solid #f)
- (speed 1.000000)
- (width 30)
+ (speed 1)
+ (width 30)
(height 20)
- (tiles
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0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0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 1009 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 61
- 61 0 0 0 1009 1009 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 1009 1009 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 1009 1009 1048 0 0 48 0 48 0 48 0 48 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 48 61
- 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 1063 0 1064 0 1065 0 1066 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61
- 61 48 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61
- 61 48 48 48 0 1311 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61
- 61 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 61
- 61 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61
- 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27
- ))
+ (tiles 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 61 61 0 0 0 1009 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 0 0 48 48 48 61 61 0 0 0 1009 1009 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 1009 1009 1048 1052 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 1009 1009 1048 0 0 48 0 48 0 48 0 48 0 0 0 0 0 0 48 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 48 48 48 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 61 48 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 61 48 48 48 0 1 0 0 0 0 0 0 48 48 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
+ )
(camera
(mode "normal")
(path
- ))
- )
- )
-
-;; EOF ;;
+ (mode "circular")
+ )
+ )
+ (mrbomb
+ (direction "auto")
+ (x 736)
+ (y 416)
+ (sprite "")
+ )
+ (snowball
+ (direction "auto")
+ (x 896)
+ (y 128)
+ )
+ (spawnpoint
+ (name "main")
+ (x 150)
+ (y 100)
+ )
+ (rock
+ (x 50)
+ (y 50)
+ )
+ (rock
+ (x 50)
+ (y 100)
+ )
+ (rock
+ (x 736)
+ (y 544)
+ )
+ (rock
+ (x 736)
+ (y 576)
+ )
+ (rock
+ (x 768)
+ (y 576)
+ )
+ (rock
+ (x 768)
+ (y 544)
+ )
+ (rock
+ (x 736)
+ (y 512)
+ )
+ (rock
+ (x 768)
+ (y 512)
+ )
+ (rock
+ (x 768)
+ (y 480)
+ )
+ (rock
+ (x 736)
+ (y 480)
+ )
+ (rock
+ (x 800)
+ (y 256)
+ )
+ (rock
+ (x 768)
+ (y 224)
+ )
+ (rock
+ (x 800)
+ (y 224)
+ )
+ (rock
+ (x 768)
+ (y 192)
+ )
+ (rock
+ (x 800)
+ (y 192)
+ )
+ (rock
+ (x 768)
+ (y 160)
+ )
+ (rock
+ (x 800)
+ (y 160)
+ )
+ )
+)
#include "object_factory.hpp"
Rock::Rock(const lisp::Lisp& reader)
- : MovingSprite(reader, "images/objects/rock/rock.sprite", LAYER_OBJECTS+1, COLGROUP_STATIC)
+ : MovingSprite(reader, "images/objects/rock/rock.sprite")
{
- grabbed = false;
+ on_ground = false;
flags |= FLAG_SOLID | FLAG_PORTABLE;
}
void
Rock::update(float elapsed_time)
{
- if(!grabbed) {
- flags |= FLAG_SOLID;
- set_group(COLGROUP_STATIC);
+ if( !on_ground ) {
movement = physic.get_movement(elapsed_time);
- } else {
- physic.set_velocity(0, 0);
- flags &= ~FLAG_SOLID;
- set_group(COLGROUP_DISABLED);
}
-
- grabbed = false;
- /*
- printf("%p - V %3.1f %3.1f - P %3.1f %3.1f\n", this,
- physic.get_velocity().x, physic.get_velocity().y,
- get_pos().x, get_pos().y);
- */
}
void
-Rock::collision_solid(const CollisionHit& )
+Rock::collision_solid(const CollisionHit& hit)
{
physic.set_velocity(0, 0);
+ if( hit.bottom ){
+ on_ground = true;
+ }
}
HitResponse
-Rock::collision(GameObject& , const CollisionHit& )
+Rock::collision(GameObject& other, const CollisionHit& hit)
{
- if(grabbed) {
- return PASSTHROUGH;
+ if( !on_ground ){
+ return FORCE_MOVE;
}
-
- return SOLID;
+
+ //Fake being solid for moving_object.
+ MovingObject* moving_object = dynamic_cast<MovingObject*> (&other);
+ if( moving_object ){
+ if( hit.top ){
+ float inside = moving_object->get_bbox().get_bottom() - get_bbox().get_top();
+ if( inside > 0 ){
+ Vector pos = moving_object->get_pos();
+ pos.y -= inside;
+ moving_object->set_pos( pos );
+ }
+ }
+ CollisionHit hit_other = hit;
+ std::swap(hit_other.left, hit_other.right);
+ std::swap(hit_other.top, hit_other.bottom);
+ moving_object->collision_solid( hit_other );
+ }
+ return FORCE_MOVE;
}
void
Rock::grab(MovingObject& , const Vector& pos, Direction)
{
movement = pos - get_pos();
- grabbed = true;
+ set_group( COLGROUP_DISABLED );
+ on_ground = true;
+
+}
+
+void
+Rock::ungrab(MovingObject& , Direction ){
+ set_group( COLGROUP_MOVING );
+ on_ground = false;
+ physic.set_velocity(0, 0);
}
IMPLEMENT_FACTORY(Rock, "rock");