Two Sprites, One Location

Get help using Construct 2

Post » Sat Feb 15, 2014 11:08 am

Hello everyone,
     I started using Construct 2 last night thanks to the recommendation of a friend. I've used GameSalad for two years now, so I thought I'd have a decent handle on this. Unfortunately, this is not the case.

I am trying to set up a sprite (and it's copies) to (when clicked) spawn a different sprite over top of itself or replace it....either way. When this new sprite is clicked, it should destroy itself and reveal/create the image previously in its place. Essentially, I'm looking to toggle one sprite for another at the user's will.

[Sprite A] is clicked >> [Sprite B] is spawned
[Sprite B] is clicked >> [Sprite A] is back in view/respawned

I've tried using Instance Variables with a handful of different combinations of conditions/actions. The only results I've gotten have been to create several (not infinite) sprites....or clicking the initial sprite in question ends up doing nothing at all.

Any help people could give me would be greatly appreciated.

Posts: 9
Reputation: 243

Post » Sat Feb 15, 2014 12:47 pm

Do they have to be separate objects?

If I was doing this (based on the details you give above, I don't know the wider context of course), then I would change animations rather than destroy/respawn object.

If Animation1 is playing + object clicked >> change to animation2
If animation2 is playing + object clicked >> change to animation1.

Glad to see you've started using C2. I was a former MMF2 user and I've found C2 to be fantastic personally.

Let me know if that helps and answers your question.
Posts: 92
Reputation: 688

Post » Sat Feb 15, 2014 6:29 pm

I don't know if this will clear anything up, but the reasoning I thought to use two objects is because the images, themselves, are completely different. Similar shape, yes, but different images.
Posts: 9
Reputation: 243

Post » Mon Feb 17, 2014 4:29 am

If it helps any further, the initial sprite has no collision. But, the second sprite (when placed) has collision detection. Change animation wouldn't work, would it?
Posts: 9
Reputation: 243

Post » Mon Feb 17, 2014 9:03 am

What do you mean with the initial sprite has no collision?
I do hope it has a collision polygon or else touching/clicking it won't have any effect, for it won't register the touch/click.

Using animationframes or animations would be my best bet. Turning the solid behaviour on and of depending on which frame or animation is playing shouldn't be a problem.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Return to How do I....?

Who is online

Users browsing this forum: anhduc3108, candyman201, fbarraza28 and 9 guests