Animation, Lives and Collision help

devmattdevmatt Member Posts: 38

We have a game where there are falling actors and the goal of the game is to catch them. When the falling actor collides with the catching actor, the catching actor then displays an animation, 30 fps. Whenever it hits the ground actor, about half the size of the catching actor, then the player loses a life. So there are two issues. The first is that when the falling actor collides with the catching actor, it is destroyed and the catching actors displays its animation. That is the way it is supposed to work anyway. The actor was successfully destroyed but unfortunately the animation was not displayed. To fix this, we made it so it was destroyed 0.1 seconds after colliding with the catching actor, and this worked. But in doing so, another problem is created. That is, if done at the right time, even when successfully catching the falling actor and earning a point, the player will still lose a life because of that 0.01 seconds allowing the falling actor to hit the ground actor. Meaning that the player earns a point but loses a life at the same time, which we do not want at all. The most obvious way to fix this is to just eliminate the "destroy after 0.1 seconds" part, but in doing so we also eliminate the animation which we would very much like to keep.

Is there anyway to make it so when the falling actor collides with the ground actor, -1 life, UNLESS it collies with the catching actor?

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @devmatt, you give two different times in your post, 0.1 and 0.01? Which one do you use? 0.1 is too long, I would use 0.02.

    If this is still too long, letting the falling actor hit the ground, then make a self attribute in the falling actor, setting it to true if it touched the catching actor.

    Then wrap the -1 life in a rule testing for this.

  • devmattdevmatt Member Posts: 38

    Sorry for being unclear. It is after 0.1 seconds that it is destroyed. I tried having it be destroyed after 0.02 seconds but the animation then appears much too quickly to be noticed. I will try making the attribute in the falling actor, and set it to true if touched the catching actor. What kind of attribute shall this be?

  • devmattdevmatt Member Posts: 38

    On second thought I am not so sure that will work anyway. The animation seems to only play properly when it is after 0.1 seconds. Of course that leaves us with the issue of hitting the ground actor.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited May 2014

    @devmatt, if you allow for a 0.02 (not a whole 0.1) delay before the falling actor destroys, then the catching actor will have enough time to notice that the falling actor touched it, and play the animation.

    The falling actor should have a self.TouchedCatcher attribute (integer).

    Rule if overlaps with catching actor
             then self.TouchedCatcher = 1
             Timer after 0.02 seconds destroy 
    

    Then have the rule:

    Rule: if self.TouchedCatcher = 0 and overlaps with ground
             then -1 lives.
    
  • devmattdevmatt Member Posts: 38

    It did not fix the problem I'm afraid, and 0.02 seconds doesn't work for the animation.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited May 2014

    @devmatt said:
    and the catching actors displays its animation

    How does the 0.02s delay in the falling actor affect the animation in the catching actor?

  • devmattdevmatt Member Posts: 38

    It does not affect it. There is no animation that occurs, except for one instance (in the several times it hit the actor) where it seemed to happen but much too quickly, or not finish. The animation is simple, 3 different images, run to completion, 30 frames per second.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @devmatt said:
    It did not fix the problem I'm afraid, and 0.02 seconds doesn't work for the animation.

    Then I am misunderstanding something. Pitty, because it sounds easy to overcome. Can you make a video to show exactly what you want?

  • devmattdevmatt Member Posts: 38

    ALso I just noticed this problem occurs even without a timer delaying the time it takes to destroy the falling actor. It is still possible to get the a point and lose a life at the same time. Perhaps rather than fixing the animation this is the only issue we need to focus on, so that it's impossible to catch the falling actor and miss it at the same time.

Sign In or Register to comment.