(time 999)
(sector
(name "main")
- (width 30)
- (height 20)
(gravity 10.000000)
(background (image "arctis.jpg")
(speed 0.5))
- (spawnpoint (name "main") (x 150) (y 200))
+ (spawnpoint (name "main") (x 150) (y 100))
(rock (x 50) (y 50))
- (rock (x 50) (y 100))
- (rock (x 50) (y 150))
+ ;;(rock (x 50) (y 100))
+ ;;(rock (x 50) (y 150))
(tilemap
(layer "background")
(solid #f)
}
if(!controller->hold(Controller::ACTION) && grabbed_object) {
- grabbed_object = 0;
// move the grabbed object a bit away from tux
Vector pos = get_pos() +
- Vector(dir == LEFT ? -bbox.get_width() : bbox.get_width(),
+ Vector(dir == LEFT ? -bbox.get_width()-1 : bbox.get_width()+1,
bbox.get_height()*0.66666 - 32);
- MovingObject* object = dynamic_cast<MovingObject*> (grabbed_object);
- if(object) {
- object->set_pos(pos);
+ MovingObject* moving_object = dynamic_cast<MovingObject*> (grabbed_object);
+ if(moving_object) {
+ moving_object->set_pos(pos);
} else {
#ifdef DEBUG
std::cout << "Non MovingObjetc grabbed?!?\n";
#endif
}
+ grabbed_object = 0;
}
if(!dying && !deactivated)
* called each frame when the object has been grabbed.
*/
virtual void grab(MovingObject& object, const Vector& pos) = 0;
-
- /** called when object isn't grabbed anymore */
- virtual void ungrab(MovingObject& object)
- {
- (void) object;
- }
};
#endif
void
Rock::draw(DrawingContext& context)
{
-
sprite->draw(context, get_pos(), LAYER_OBJECTS);
}
{
if(!grabbed) {
flags |= FLAG_SOLID;
- set_group(COLGROUP_STATIC);
+ set_group(COLGROUP_MOVING);
movement = physic.get_movement(elapsed_time);
} else {
physic.set_velocity(0, 0);
HitResponse
Rock::collision(GameObject& object, const CollisionHit& )
{
- if(grabbed)
+ if(grabbed) {
return FORCE_MOVE;
+ }
if(object.get_flags() & FLAG_SOLID) {
- physic.set_velocity(0, 0);
- return CONTINUE;
+ physic.set_velocity(0, 0);
+ return CONTINUE;
}
return FORCE_MOVE;
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
-
#ifndef __ROCK_H__
#define __ROCK_H__