0 Favourites

Spawn a sprite on top of another...

  • This is day 4 for me and I have built some really cool stuff so far but this simple task is bringing me to total aggravation. I searched the forum without a clear answer and it seems really really simple for future clarification on expressions editing (which I am sure is my issue) please link me to an in depth expressions tutorial.

    Objective:

    Click Circle to have Circle spawn on top of square.

    Troubleshooting:

    Opened a clean project to make sure it wasn't a bug.

    I have checked my layers (so they lay on top of each other properly)

    I have tried using Square.X as the spawn point but it will not take.

    I added an Imagepoint in the center of my Square but when I enter Square.Imagepoint(1) it says no. (probably missing the correct expression)

    Here is my capx.

    dropbox.com/s/wsztgs10f71xsvl/SpriteSpawningOverSprite.capx

  • If you want to use expressions (Square.X, Square.Y), go to System -> Create object instead of using the spawn condition in the sprite object.

    Or you could use the spawn condition, but you have to select the square first, then go to the spawn condition and select the circle object. Image point you can leave as 0 if you want it to spawn at Square.X, Square.Y.

  • So then it is true that I cannot create a "circular reference" (best description) asking an object to create itself at another object point. Just tested your suggestion swapping the square and having the circle spawn on it. It might seem simple but quite frankly its not when it comes to the application I am using this for (Inventory System)

    Thank you again, very much.

  • I'm not exactly sure what you mean, but you can make an object spawn an instance of itself on a different image point. Just do Circle -> Spawn another circle at imagepoint 1. (1 if it's the first imagepoint after the origin, you could also input the name of the image point "Imagepoint 1")

    But keep in mind, if you just set this up to happen every second, EVERY circle object is going to spawn a new circle on imagepoint 1. Unless you create some sort of iteration through the IID's of the objects.

  • You have 'Circle: Spawn Circle' which makes the first Circle spawn another Circle at it's postion. You want 'Square: Spawn Circle'. That will make the Square spawn a Circle at the Square's position.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks guys, got this all figured out with your feedback. The order of operation is something that needed clarification.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,317
RetroDaddy's avatar
RetroDaddy
Unread hot topic
86 28,711
St4rDu57's avatar
St4rDu57
Unread hot topic
153 104,445
DravenX's avatar
DravenX