Spawn a sprite on top of another...

Get help using Construct 2

Post » Thu Jan 03, 2013 3:55 am

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.
https://www.dropbox.com/s/wsztgs10f71xsvl/SpriteSpawningOverSprite.capx
B
6
S
1
Posts: 25
Reputation: 675

Post » Thu Jan 03, 2013 4:17 am

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.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jan 03, 2013 4:27 am

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.boggler2013-01-03 04:28:46
B
6
S
1
Posts: 25
Reputation: 675

Post » Thu Jan 03, 2013 3:52 pm

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.Nimtrix2013-01-03 15:54:24
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jan 03, 2013 4:02 pm

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.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Thu Jan 03, 2013 5:32 pm

Thanks guys, got this all figured out with your feedback. The order of operation is something that needed clarification.
B
6
S
1
Posts: 25
Reputation: 675


Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm and 28 guests