How do I - not die on collision when using shield

0 favourites
  • 8 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I have a game almost finished but I'm having an issue with the shield in the game.

    The game is a perpetual flyer game in which I create obstacles and power ups at one side of the screen and you have to dodge them.

    For the most part it just works well however there's rare-although-increasingly-repetitive occasion in which the

    player who is shielded will die on collision with a block.

    However this should not be "possible" as the shield collision box is much larger than the player.

    I'm assuming it has to do with speed matching and rendering but I'd like to see some alternatives.

    Things to note:

    • player has platform behavior for movement and "flying" (which is actually falling)
    • shield is pinned to the player when created.
    • game is rather fast paced
    • this is happening on both mobile and browser so I know its not just a mobile problem

    basic things I cannot do at the moment :

    • I cannot remove collisions because they are needed for game progression... long story.

    Any ideas are welcome. I'll try and see if I can make a capx but it requires me to strip the game down to basics (it's a company game so I can't just post the game)

  • Hi,

    This is what I do for something similar:

    Player on collision with enemy>

    Shield is not active > Player gets hurt

    Shield on collision with enemy > Enemy gets hurt

    Hope that helps

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Actually I have something similar setup ... and its working fine it removes charges from the shield and all... for some reason on "random" ocasions its just killing the player regardless...

    Here's a sample of what I have in terms of block collision.

  • You could have a collision event on shield that destroys the enemy before it hits the player.

    If Shield collides enemy > destroy enemy

    Something like that should solve your problem!

  • thanks for the suggestion, however ... That's the thing if you see the example above that's exactly how it's working(and it is working until it gets that weird hiccup) the shield destroys the obstacle before it hits the player unfortunately either it's lagging on occasion or not fairing correctly....I'm making a stripped down(cleaner) version to see if I can Isolate the problem.

  • Wouldn't it be easier to set a variable when the shield is up and just disable damaging the player when it is? that way you don't have to worry about the collision detection being a bit behind, etc...

  • Ragevortex

    I would do same as BluePhase suggests.

    This example uses an instance variable to track if the ship has its shield up or not.

    [attachment=0:3ijxv6st][/attachment:3ijxv6st]

  • Hmm.. ill give it a try and let you know what ressults I get. Thanx for the siggestions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)