[Solved] Spawn sprite at touch end point

Get help using Construct 2

Post » Sat May 10, 2014 11:05 pm

Hi there. I have a feeling this is gonna be a duh! :roll: moment for me but here it goes. I'm trying something like "On touch end- spawn sprite at location of touch end" but I can't figure out how to get the sprite to spawn at the correct location because the Touch.X and touch.y is 0,0 and sprite always spawns at top left instead of where finger left the screen. Any ideas? Thanks a bunch!! :)
Last edited by delaflaquita on Mon May 12, 2014 9:48 pm, edited 1 time in total.
B
21
S
5
G
1
Posts: 102
Reputation: 1,741

Post » Sun May 11, 2014 12:22 am

Spawn an object there anyway at touch.X, touch.Y but make the object's property invisible.
Then use "on touch end" for the invisible object to spawn the visible object. You can then add system wait (maybe 0..5 seconds) invisible object destroy.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Sun May 11, 2014 1:14 am

That did it. Awesome! Thank youuu
B
21
S
5
G
1
Posts: 102
Reputation: 1,741

Post » Sun May 11, 2014 7:35 am

In the future please also include a much more descriptive title, many of us won't read a thread that doesn't have a title that tells us a bit about the issue as we don't have time to open and read every single thread.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Mon May 12, 2014 3:46 am

Will do! Sorry 'bout that.
B
21
S
5
G
1
Posts: 102
Reputation: 1,741

Post » Mon May 12, 2014 5:25 am

No problem, you can also edit the title of this thread to add a bit more detail about the type of problem, you may get some more responses that way as well. It is a good practice that once you have a solution, you update the title to be something like: [Solved] Spawn sprite at touch end point

That helps others find this as well if they have similar questions.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Mon May 12, 2014 5:32 am

If you need this for multiple objects and don't need them on screen (even invisible) you can set up local (or global, depending) variables that constantly record your current touch location and use those variables as the location to spawn the object.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 18 guests