0 Favourites

How do I make my object spawn on a specific spot?

  • Hey!

    On the left you can see a frame of my character running, and a frame of my character slashing his sword (note how he doesn't have legs). What I want to do is that when the player presses the J button while running, the legless sword slashing sprite would spawn on top of the running one. I pretty much got it all worked out, except for making the sprite spawn where I want it to. I tested my game, and it spawns right on top of the character's legs:

    .

    Anyone kind enough to explain how to make the sprite spawn so it would all look like this?:

  • I think you should create a new Imagepoint on the 'Running' sprite, setting the new Imagepoint on the position where you want to spawn the 'Slashing' sprite.

    And in the event, which you are spawning the 'slashing' sprite, set the position of 'slashing' spawning as the position of the Imagepoint you created in the 'Running' sprite.

    I think the solution is something like that. Please, someone correct me if I'm wrong.

  • Yes, that's exactly what I did before posting this. I thought it would work, but it doesn't for some reason, it just spawns on the legs :c

  • milk already gave you the solution.

    You need to setup an ImagePoint on the running sprite where you want the splash to be positioned. Also remember to check the origin point of the slashing sprite, these points will overlap when you create the sprite.

    Post a capx if you're still having trouble

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • milk already gave you the solution.

    You need to setup an ImagePoint on the running sprite where you want the splash to be positioned. Also remember to check the origin point of the slashing sprite, these points will overlap when you create the sprite.

    Post a capx if you're still having trouble

    That's so weird, I must be doing something wrong.. I hope no one minds walking me by my hand on this...

    1. I make an image point, called Sword, and then place it on the belt buckle of all the "running" sprite frames

    2. I set the "Slashing" sprite's origin on the belt buckle as well. Then I give the sprite a "Pin" behaviour.

    3. I set that the "Slashing" sprite would spawn at the image point "Sword" whenever the player is running and attacking at the same time. (I also make the 'slashing" sprite pin to the "running" sprite.

    4. I play test it. In theory it should work, but nope, the "slashing" sprite spawns on the "running" sprite legs.

  • It looks right, try double checking if the image point is at the right place in every single frame, on all animations, and both sprites.

    Another test you can make, remove the pin behaviour from the slashing sprite and add a Evert tick event and set Slashing sprite's position to another object (PlayerBox/running animation) at image point("Sword").

    Try uploading a capx, makes it alot easier to find what's wrong, it doesn't need to have the whole project, just the part that isn't working.

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