Need help! why "spawned" sprites shoot in sync?

Get help using Construct 2

Post » Wed Nov 28, 2012 3:43 am

Hey guys,

Im new to Construct 2, and Ive been stuck on this problem for a while..
Im trying to get multiple spawned sprites to shoot a target individually, not together

Any help would be much appreciated!

Here's the scene file I created:
The bottom half is my current scene


https://dl.dropbox.com/s/3vbo16ghqrs9ppb/Ranged.zip?dl=1


The top was a example someone previously posted, that worked
He suggested me to use "For Each" but it didnt work for some reason..avatar862012-11-28 03:48:17
B
10
S
3
Posts: 73
Reputation: 1,431

Post » Wed Nov 28, 2012 12:57 pm

@avatar86   

the problem here is that the collision happens on lineofsight object
so construct has no way of knowing wich player to pick
by saving uid of lineofsight in playerobject on creation

then compare if uid of lineofsight = player variable uid, it picks the right player

hope this helps

example
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Wed Nov 28, 2012 5:51 pm

WOahhh!! thank you sooooo much man!
Yeah I dont have any experience with Instance Variables, or Arrays yet..
I feel like thats a whole new technical side of things ><

What does "nr" stand for?
B
10
S
3
Posts: 73
Reputation: 1,431

Post » Wed Nov 28, 2012 6:59 pm

thats the variable i made on the playerobject to save the uid(unique number of that object) of lineofsight object

"nr" its just a short for "number" but you could name it anyway you like
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Thu Nov 29, 2012 6:22 am

After spawning like a whole army of them on both sides, they seem to stop shooting, and the enemy side just runs straight through...

Any ideas why that would happen? They are all overlapping the line of sight, why do they suddenly stop functioning?avatar862012-11-29 06:23:19
B
10
S
3
Posts: 73
Reputation: 1,431

Post » Thu Nov 29, 2012 4:54 pm

can you share the capx where you are, it helps to debug
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028


Return to How do I....?

Who is online

Users browsing this forum: dieblume86, Kagubro, pinellos and 2 guests