How do I create a grid-based range indicator?

Get help using Construct 2

Post » Sat Sep 05, 2015 1:16 pm

Got my movement system up, grid based moving etc.

But how do I display a range indicator that is based on square tiles?

Example:
Image

I thought about using an original range sprite, creating multiples of it via events, repositioning them and pin them to the player. But then again C2 doesn't seems to let you have control over objects created via an event...


Any thoughts?



I wanna do an Fire Emblem/Advance Wars clone.
B
3
Posts: 2
Reputation: 179

Post » Sat Sep 05, 2015 6:47 pm

I made this a while ago:
sequential-grid-span-class-posthilit-based-span-movement_p695580?#p695580
I'm unsure if it would be helpful, it comes across as fairly complicated.

Basically what you could do first is place all your tiles down as sprites. Next put the tile sprite in a family and give them a boolean variable called "selected". The reason for a family is so two separate instances can be referenced.

You then can expand the selection one unit in all directions with:

Family1: boolean "selected" is true
Sprite: is overlapping family1
--- sprite: set selected to true

Throw a repeat above that if you want it done multiple times:

repeat 2 times
Family1: boolean "selected" is true
Sprite: is overlapping family1
--- sprite: set selected to true


The only issue now is diagonal tiles are also selected. To fix that make the tile's collision polygon with beveled corners or more octagon shaped.
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775

Post » Sat Sep 05, 2015 8:10 pm

Well, thank you, but it seems like I have to search for another way to get this going...
B
3
Posts: 2
Reputation: 179

Post » Mon Sep 07, 2015 6:59 pm

Well... hmm, you could just create the highlighted squares around the center one with a bunch of create actions. But I consider that a brute force way and I'm very lazy when it comes to repetitive stuff like that.

On a side note you certainly can control objects you created with events. There just are a few picking things you need to consider.
For instance:
viewtopic.php?f=146&t=125724&p=890954&hilit=toplevel#p890954
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775

Post » Mon Sep 07, 2015 11:13 pm

I use distance as a radius range:
https://dl.dropboxusercontent.com/u/659 ... ient3.capx

The example also show how blocking path works.
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 19 guests