selection bug?

Bugs will be moved here once resolved.

Post » Tue Oct 24, 2017 9:01 am

Problem Description
selected 'enemy' is wrong

Attach a Capx ... .capx?dl=0

what i want to make is to create a '!' object above the 'enemy' whose 'Attack cooldown' is 0 or less, and thus, i use
'create object '!' on layer 0 (enemy.x, enemy.y - enemy.height/2 - 35)' action on
'if enemy.curATKCD <= 0' condition

in hope that the object '!' will be created above the enemy whose curATKCD reached 0 or below

but it doesnt work, the '!' is created on a random 'enemy' instead

i can circumvent this by using 'enemy spawn object' instead... but i'm pretty sure my coding aren't wrong :|
also using enemy spawn object, i need to make the spawn point for ALL the enemy, which is going to be a lot

I dunno if it's my logic that's wrong or this is an actual bug (as i expected the enemy object to be selected when the conditions is met, but it doesnt seem so, random enemy object is selected instead)

Steps to Reproduce Bug
just wait a few seconds

Affected Browsers
  • FireFox:

Operating System and Service Pack
windows 10

Construct 2 Version ID
Posts: 14
Reputation: 578

Post » Wed Nov 15, 2017 12:15 pm

It's just a mistake in your events. Since 'Create object' is a system action, it runs once regardless of how many Enemy instances are picked. This is all documented. You can add a 'For each enemy' condition after the comparison to force it to run the 'Create object' action once per picked Enemy, which is what the 'Spawn an object' action does automatically (because it's an action in Enemy).

Another mistake in your events is that you continue to create hundreds of "!" objects because the condition is continually true. You probably want a boolean instance variable to mark if you've already created it.
Scirra Founder
Posts: 25,279
Reputation: 200,817

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests