I didn't target that enemy!

Get help using Construct 2

Post » Tue Dec 04, 2012 4:01 am

Hello.


I made instances of sprites called "SpawnSpell" and once I target an "Enemy" the SpawnSpell sprite is selected at a random instance and spawns a spell and targets an enemy to destroy it.

The problem is, sometimes when I click on an enemy to destroy it, the spell sprite tends to target another enemy, and not the one I intended t destroy. How can this issue be solved?


Here is my project file:

https://www.dropbox.com/s/qfi9otk8mxv87es/Allah.capx

Thanks for the help!GameThirsty2012-12-04 04:05:53
B
16
S
6
Posts: 348
Reputation: 2,583

Post » Tue Dec 04, 2012 11:29 pm

No one know?
B
16
S
6
Posts: 348
Reputation: 2,583

Post » Wed Dec 05, 2012 4:13 pm

Seems like I wasted $120 USD for license and I can never get any help here.
B
16
S
6
Posts: 348
Reputation: 2,583

Post » Wed Dec 05, 2012 5:52 pm

I can't view your capx as I'm running 108, but some context would be appreciated; like the genre of game for background knowledge.

Is the spell a bullet? Is the same enemy destroyed each time?

A prtscrn of the event sheet would be helpful (Y)
B
49
S
14
G
3
Posts: 540
Reputation: 5,611

Post » Wed Dec 05, 2012 7:11 pm

Event 9 you set 'red' towards 'enemy'. Which enemy though? You haven't specified so they'll all just move towards the first in the list. You need associate each 'red' with a specific enemy.

Give 'red' a number instance variable called 'targetUID'.
When you spawn the 'red', set it's 'targetUID' to 'enemy.UID'
and then in event 9 instead of every tick have

system: for each red
enemy: pick by UID red.targetUID
---> red: set angle toward (enemy.x, enemy.y)
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sat Dec 08, 2012 1:47 am

I cant get that to work ^ What I need to do is probably declare a variable and for each enemy spawned, give it a number and when clicked on enemy it goes to that number.
B
16
S
6
Posts: 348
Reputation: 2,583


Return to How do I....?

Who is online

Users browsing this forum: Mohicano, Yahoo [Bot] and 27 guests