Two Sprites, One Location

0 favourites
  • 5 posts
From the Asset Store
Huge collection of icons like internet, setting , wi-fi, upload, download, recycle, location and much more
  • 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.

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)