UID Help

Get help using Construct 2

Post » Mon May 20, 2013 11:45 am

Hey its me again :x
I got the following problem:
I have 1 Object "Bat", the Bat is Created Random every 1 - 5 seconds and moves left toward my player,
My player shoots the bats with shuriken and destroys them.

What i want to do: When you shoot a bat, theres a random chance this bat Drops an item, but how do i do that? Thought about using UID's but then i would have to know which bat got hit..
Tried the following: "Shuriken on Collision with Bat"-> "Bat Spawn another Object Item on Bat.X Bat.Y" "Bat.Destroy, Shuriken.Destroy" but that doesnt work :/ it creates the Item somewhere in the screen, but not at the position of the bat..

p.s.: its important that the bat drops the item and not the shuriken, because i got particle weapons as well, which would look strange

edit: tried with pick nearest bat from shuriken, but same problem like above: creating item somewhere on the layoutDesory2013-05-20 11:46:06
B
3
S
1
Posts: 32
Reputation: 391

Post » Mon May 20, 2013 12:20 pm

I think the image point, that is the origin of the bat is too far away from the bat drawing itself, thus the "it spawns somewhere else" problem.
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Mon May 20, 2013 12:22 pm

Why do you use Bat.X and Bat.Y on the "spawn another object" action?
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Mon May 20, 2013 12:50 pm

If I understand this is what you wanna do?

2 objects collision then spawn another in the same position?

https://mega.co.nz/#!Z542mRYS!SlnSuUADWL2HLOsmfD2IZ1wJVCRNXwdwsB0XuGYKHAY
B
14
S
4
G
1
Posts: 42
Reputation: 1,775

Post » Mon May 20, 2013 5:58 pm

Shuriken> On collision with bat
>Destroy bat
>Destroy Shuriken

Bat > On destroyed
>Spawn another object

This way, when the shuriken hits, it destroys both, and then whenever a bat is destroyed it spawns an object.Thndr2013-05-20 17:59:15
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Mon May 20, 2013 7:11 pm

https://www.scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,209
Reputation: 18,357

Post » Mon May 20, 2013 10:27 pm

Thanks for all of your replies:
fassflash: on start of layout i destroy the bat, thus the problem is solved , and anyway the bat was outside the layout positioned so i would not be able to see where that item spawns.
Bat.X and Bat.Y because the shuriken which collides with the bat gives the bat a .this function (in java) and spawns on destroyed bat an item.. didnt work, but hey,
I FIXED IT ..
so:
1. Every Second set Randomdrop to random(2)
2.Shuriken -> on collision with bat AND randomdrop = 1 -->> spawn item at bat.imagepointx and bat.imagepointy
3. Shuriken on collision with bat , -> bat destroy, shuriken destroy,
B
3
S
1
Posts: 32
Reputation: 391


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests