How do I Spawn An Object On A Destroyed Tile Using Tilemaps?

Get help using Construct 2

Post » Thu Oct 02, 2014 3:20 pm

Whatsup peeps,

Im having issues tryin to spawn an object on a destroyed tile,I know my logic is there but im not getting anything to spawn when my tile is actually destroyed.

Ive done this a million times using sprites but it seems that the tilemap is missing a function that allows me to spawn an object from it.
Is there a special way i need to code this to make it happen? If so could someone give me a few details because ive tried everything that i know how to do. Thanks
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Thu Oct 02, 2014 3:27 pm

Just use the "Create object" action under the System object.
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Thu Oct 02, 2014 3:30 pm

@Magistross Ive done that and somehow nothing is spawning for me at all,I know how to spawn objects in that fashion but for some reason its not working for me with tilemaps.
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Thu Oct 02, 2014 3:35 pm

There is either a problem with your object creation event, or the object is indeed created but wrongly positionned. May I see what you've done so far ?
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Thu Oct 02, 2014 3:39 pm

@Magistross here you go

http://imgur.com/rQbCBvZ
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Thu Oct 02, 2014 3:49 pm

Ok, the "On destroyed" event is most probably never called. Erasing tiles in a tilemap won't trigger any event, so you should bundle the touch event and the "On destroyed" one together. A function would do the trick.
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Thu Oct 02, 2014 3:58 pm

@Magistross im alittle confused about what your are trying to say.
Could you maybe give me some psedo code in the post?
I bundled up the events like you said and nothing is happening im confused?
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Thu Oct 02, 2014 4:21 pm

I'm a bit confused too as to what you are trying to achieve. If you want to erase a touched tile and replace it by a corresponding sprite, here's a simple example.
You do not have the required permissions to view the files attached to this post.
B
75
S
31
G
27
Posts: 1,015
Reputation: 20,765

Post » Thu Oct 02, 2014 4:27 pm

@Magistross im trying to destroy a tile and spawn an item in its place. Think of it as loot.
Once its destoyed i am trying to make the destryed tile drop an item in its place.
Thank you for the example,you didnt have to go through all of this.Im new but i have learned enough that seeing you write code in a post is something i can understand now.
i will check this out right now.
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Thu Oct 02, 2014 5:01 pm

@Magistross this still is not working for me,I mimic your style and still no positve outcome has come out of this.
Is this the only way for me to deal with this issue? im not sure why your logic is not working ive done everything your way.
Its destroys the tile but nothing spawns in its place.
B
9
S
5
Posts: 126
Reputation: 1,295

Next

Return to How do I....?

Who is online

Users browsing this forum: luckyrawatlucky and 4 guests