How do I get a UID from a sprite created in game by script?

Get help using Construct 2

Post » Mon Jun 08, 2015 9:19 pm

I really need help finding this one :) Thanks in advance peeps :D
A box isn't a box without 6 sides.
B
19
S
3
Posts: 26
Reputation: 1,810

Post » Mon Jun 08, 2015 9:24 pm

Sprite.UID?
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Mon Jun 08, 2015 9:31 pm

I know that is there but I need to save it to a variable, should have mentioned that XD
A box isn't a box without 6 sides.
B
19
S
3
Posts: 26
Reputation: 1,810

Post » Mon Jun 08, 2015 9:41 pm

Set variable to sprite.uid?

If you know which sprite you mean, you should be able to tell c2 which sprite you mean..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 9:44 pm

Can you give more detail about what you are actually trying to do ?
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Mon Jun 08, 2015 10:14 pm

Alright sorry guys haha.

So I have a sprite that when you click it another sprite appears and then it sets the sprites X and Y to the mouse (as though you were moving it) and when you click it, it creates a new sprite that I can't see the UID of because it isn't created in the engine only in the game itself. I need to find out how I can target that 1 new sprite so that all the other sprites of the same sprite don't move to Mouse X and Y only the new object does. I hope this makes sense :P Thanks for the responses :)
A box isn't a box without 6 sides.
B
19
S
3
Posts: 26
Reputation: 1,810

Post » Mon Jun 08, 2015 10:22 pm

On click:
- system create sprite on "layer" (Mouse.x, mouse.y)
- system set GlobVariable to sprite.uid

You can move the sprite whose UID matches your variable "GlobVariable"
Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Post » Mon Jun 08, 2015 10:47 pm

MadSpy wrote:On click:
- system create sprite on "layer" (Mouse.x, mouse.y)
- system set GlobVariable to sprite.uid

You can move the sprite whose UID matches your variable "GlobVariable"


That worked, thanks :D

Gotta admit the scirra community are amazing :)
A box isn't a box without 6 sides.
B
19
S
3
Posts: 26
Reputation: 1,810


Return to How do I....?

Who is online

Users browsing this forum: evillair, YoHoho and 10 guests