How do I - not die on collision when using shield

Get help using Construct 2

Post » Fri May 02, 2014 4:40 pm

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)
You do not have the required permissions to view the files attached to this post.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,796

Post » Fri May 02, 2014 4:59 pm

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 :)
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
34
S
12
G
7
Posts: 358
Reputation: 7,148

Post » Fri May 02, 2014 6:03 pm

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 do not have the required permissions to view the files attached to this post.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,796

Post » Fri May 02, 2014 6:23 pm

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!
B
10
S
2
Posts: 22
Reputation: 654

Post » Fri May 02, 2014 7:08 pm

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.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,796

Post » Fri May 02, 2014 9:56 pm

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...
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Sat May 03, 2014 1:37 am

@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.

ShieldExamleCode.png
You do not have the required permissions to view the files attached to this post.
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
34
S
12
G
7
Posts: 358
Reputation: 7,148

Post » Sat May 03, 2014 5:51 pm

Hmm.. ill give it a try and let you know what ressults I get. Thanx for the siggestions.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,796


Return to How do I....?

Who is online

Users browsing this forum: mihirolover, tarek2 and 13 guests