One shot kill many monsters

For questions about using Classic.

Post » Thu Jan 29, 2009 10:44 am

[url:n5g2zc9a]http://macwys.on1.biz/mountain.cap[/url:n5g2zc9a]

One shot kill many monsters.

How can I fix this?
B
2
G
3
Posts: 27
Reputation: 904

Post » Thu Jan 29, 2009 10:54 am

Seems to work properly for me. One shot, one kill.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Jan 29, 2009 11:16 am

Not when the two monsters in one place.
B
2
G
3
Posts: 27
Reputation: 904

Post » Thu Jan 29, 2009 12:13 pm

It's because your bullet is big enough to overlap more than one monster at a time, so it's possible to trigger "On collision" for more than one monster before it disappears off-screen.

Add a "For each monster" loop at the beginning of your bullet-collision event, that will take care of it.

But really... you're doing so many odd things in the game I think you should probably go through the Ghost Shooter tutorial first. You're moving your bullet manually, and a) you don't need to, because there is a Bullet Behavior, and b) you're not using TimeDelta to move it (or your monsters, for that matter), so it will run differently on different computers. Whenever you move something manually you should always use TimeDelta.

Also, if you switch to Bullet Behavior for your bullets, you can spawn them and destroy them instead of using just one bullet object and setting it's position off-screen when you don't need it.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 29, 2009 2:55 pm

http://macwys.on1.biz/monkey.cap

I do not want to be boring.

But how to do that only a one banana disappeared?
B
2
G
3
Posts: 27
Reputation: 904

Post » Thu Jan 29, 2009 3:44 pm

[quote="maciek":3oe253j9]http://macwys.on1.biz/monkey.cap

I do not want to be boring.

But how to do that only a one banana disappeared?[/quote:3oe253j9]

you know what? when i turned on preview mode, nothing appeared, only blank screen. i turned it off and cons crashed. BUG.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Thu Jan 29, 2009 3:48 pm

Open "Event Sheet Editor".
B
2
G
3
Posts: 27
Reputation: 904

Post » Thu Jan 29, 2009 4:29 pm

If two or more bananas are touching the monkey and you want to destroy only one together with monkey, you have to PICK the banana. You can pick random, closest or whatever you want.

[code:wqeun6kf]+Pick a random banana
+On collision between banana and monkey
> monkeyDestroy
> bananaDestroy[/code:wqeun6kf]
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Jan 29, 2009 4:48 pm

[quote="megatronx":2bx4a10c][quote="maciek":2bx4a10c]http://macwys.on1.biz/monkey.cap

I do not want to be boring.

But how to do that only a one banana disappeared?[/quote:2bx4a10c]

you know what? when i turned on preview mode, nothing appeared, only blank screen. i turned it off and cons crashed. BUG.[/quote:2bx4a10c]

Nothing should show if you check the events.

When did it crash?
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Jan 29, 2009 6:03 pm

[quote="deadeye":1ed8d991]It's because your bullet is big enough to overlap more than one monster at a time, so it's possible to trigger "On collision" for more than one monster before it disappears off-screen.

Add a "For each monster" loop at the beginning of your bullet-collision event, that will take care of it.

But really... you're doing so many odd things in the game I think you should probably go through the Ghost Shooter tutorial first. You're moving your bullet manually, and a) you don't need to, because there is a Bullet Behavior, and b) you're not using TimeDelta to move it (or your monsters, for that matter), so it will run differently on different computers. Whenever you move something manually you should always use TimeDelta.

Also, if you switch to Bullet Behavior for your bullets, you can spawn them and destroy them instead of using just one bullet object and setting it's position off-screen when you don't need it.[/quote:1ed8d991]

Yes, my shot touches two monsters.

But I want to only one death.

In c++ I wrote...

[code:1ed8d991]for(int i=0 ; i<monstersAmount ; i++)
{
if(bullet.collision(monster[i]) && bullet.life == 1)
{
monster[i].destroy();
bullet.life = 0;
}
}[/code:1ed8d991]

...and a one monster that has been destroyed.

How to destroy an object instead of two?

Screenplay:
[code:1ed8d991]1. shot hits two monsters
2. first monster dies
3. shot is destroyed
4. second monster did not die, because there is no longer a shot[/code:1ed8d991]
B
2
G
3
Posts: 27
Reputation: 904

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest