Can a Mouse Click Detect an objects UID?

Get help using Construct 2

Post » Tue Jul 16, 2013 2:39 am

Hi all,

I am wondering if it is possible to have a mouse click detect an objects UID.
I ask this because i have a good many of Dirt Tiles in my world and i want the player to be able to destroy and create them at will.
The issue im having is when i destroy a tile it destroys all of my dirt tiles,I came to the conclusion that it must be some sort of issue on my part.Can anyone fill me in on this?
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Tue Jul 16, 2013 2:49 am

Shouldn't happen that way, it should only delete the tile you click on.

This example I just created a square sprite, copy and pasted it a few times. Added the mouse object.

On Object Click - Destroy

https://www.dropbox.com/s/nr9isqh6daea8vr/clickdestroy.capxArcadEd2013-07-16 02:51:14
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,497

Post » Tue Jul 16, 2013 2:57 am

Thank You @ArcadEd i will check this out right now,I thought it was something that i was doing wrong.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Tue Jul 16, 2013 3:03 am

Ok @ArcadEd i think i see what i was doing wrong,I have All of my solid blocks that are bulding blocks in a family.I was destroying all solids.
But after seeing this it looks like i have to create a seperate event for each Block tile i want to destroy in this fashion.Is this true?
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Tue Jul 16, 2013 3:15 am

Just change the Sprite to the Family.

https://www.dropbox.com/s/80yc5xkoz5lty7h/clickdestroy-family.capxArcadEd2013-07-16 03:16:03
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,497

Post » Tue Jul 16, 2013 3:36 am

Thanks @ArcadEd to wrap things up i wanted to ask you do you know where i can see a good example of UIDs in a sandbox type of game?

There are very few sandbox/tile game examples on how things are done.alot of them are terrain generation,But none on drawing animations onto tiles and making them look like they are breaking.

Thanks again for helping me out.Awesome Website Aswell!!
RookieDev2013-07-16 03:50:45
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Tue Jul 16, 2013 4:26 am

I assume you mean like how Minecraft uses IDs for each of the items in the game? Probably the best thing to do is learn Arrays and how they work in construct. Then you can create an arrays with info on each ID.
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,497

Post » Tue Jul 16, 2013 4:38 am

@ArcadEd Me and arrays dont get along the best,I have tried to learn them but fall short when it comes to making tiles appear.I am not the best at arrays thats why im looking for alternate routes.

I think/Hope that i will be able to get around them since my world size is not as big as something like minecraft or terraria.
RookieDev2013-07-16 04:41:10
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Tue Jul 16, 2013 5:11 am

[QUOTE=RookieDev]
There are very few sandbox/tile game examples on how things are done.alot of them are terrain generation,But none on drawing animations onto tiles and making them look like they are breaking.[/QUOTE]

There are dozen ways of doing that. It all depends what you want to do.
Hold left mouse button on any block https://dl.dropboxusercontent.com/u/34375299/Construct%202/examples/dest.capx
ImageImageImageImage
B
155
S
61
G
41
Posts: 2,577
Reputation: 34,324

Post » Tue Jul 16, 2013 5:18 am

@shinkan   THAT IS EPIC!!! that looks awesome man do you mind if i mimic your style for the block breaking,I wont use your sprites i just want to learn from this.
This is pretty awesome man.Thank you guys for helping,I have been getting alot of help as of late and i am very grateful to have people that care around.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Next

Return to How do I....?

Who is online

Users browsing this forum: Youtopize and 6 guests