Collision Query [Please help!]

Get help using Construct 2

Post » Sun May 27, 2012 8:21 pm

Hi there everyone, I've just started using Construct 2, and as an animator who's dreamed of making games but been horrified of syntax and big scary computer things; it's quite literally a dream come true.

Gushing aside, I've been slowly chipping away at making a top down shooter, and I'm having trouble making one of the weapons work the way I want; basically it's a top hat that when thrown can bounce off of enemies and walls, doing damage as it goes (Think Oddjob from James Bond!) Thanks to the bounce bullet command, this is easy!

The trouble comes when I try and complicate the weapon, I'd like it so that if the player was able to direct the hat in such a way that it bounce back and hit the player, they would regain ammo and be able to do it again (As well as net a puntastic Hatarang achievement): By adding a collision event between player and bullet in which this would occur, I've broken my attempt, as the bullet is instantly destroyed upon spawning.

Any suggesstions? I was thinking of making it spawn on player.x +5, player.y +5, but I can't work out a way to implement that in the event sheet; I'm probably being dumb! Another way I think might work would be if I had a variable that incremented every time the bullet and player collided, and if the value was even, then the bullet would be destroyed: No real idea how to do that...


Please ignore what I imagine is awful C2 etiquette/programming, I'm not that way inclined unfortunately!

tl;dr: How do I stop a collision event between player and bullet on the initial event? Mr E Bear2012-05-27 21:30:57
B
49
S
14
G
3
Posts: 540
Reputation: 5,611

Post » Sun May 27, 2012 8:28 pm

What you want to do is register the first non player hit
This way, if the hat already hit something and it hit the player it can be destroyed.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun May 27, 2012 8:43 pm

Here is a capx showing how to have a player object throw another object, have it bounce off a wall, and then catch it. It just uses an instance variable in the thrown object.

http://dl.dropbox.com/u/6109058/HatarangDemo.capxjimand2012-05-27 20:45:20
B
16
S
4
G
1
Posts: 40
Reputation: 2,705

Post » Sun May 27, 2012 8:55 pm

That makes all kinds of sense, thanks guys!
B
49
S
14
G
3
Posts: 540
Reputation: 5,611


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests