Creating Maximum Movement Indicators on a Board

Get help using Construct 2

Post » Thu Aug 08, 2013 8:52 am

I'm honestly still not convinced.

Your method works, and I'm not going to question that. It's also simple and easy to understand.

However, I do think it's possible to do this without making the squares be there (even if invisible). I have a screenshot on page 1 showing how I'm trying to do it, although for some odd reason it fails after a certain point and begins saying all remaining squares on the board do not exist, and I'm not quite sure why.

Another reason is because I don't want to have to populate the entire board when creating a pregenerated board state. I want to be able to place the squares (aligned to grid, of course) and not have to place invisible ones in order for the array to work.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Thu Aug 08, 2013 9:10 am

[QUOTE=Excal] I'm honestly still not convinced.

Your method works, and I'm not going to question that. It's also simple and easy to understand.

However, I do think it's possible to do this without making the squares be there (even if invisible). I have a screenshot on page 1 showing how I'm trying to do it, although for some odd reason it fails after a certain point and begins saying all remaining squares on the board do not exist, and I'm not quite sure why.

Another reason is because I don't want to have to populate the entire board when creating a pregenerated board state. I want to be able to place the squares (aligned to grid, of course) and not have to place invisible ones in order for the array to work.[/QUOTE]

Sure, it is possible, but it will take a whole different approach. Just making some squares invisible is the simplest way to do what you want. Don't really see why placing invisible squares is a bad thing, takes about 5 seconds. :)

Creating a level could be like this :
Create row of 20 squares
Select all, and copy paste them as 15 columns
Add walls
Make some squares invisible if necessary

But you know better yourself what you want your process to be, this is just how I would create something like your screenshots at first post suggest.
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Thu Aug 08, 2013 11:20 pm

@vee41

The game board is 18x7, and filling every possible space with a square (even if invisible) is 126 sprites. Add in UI sprites, the gameplay sprites, background image + sprites to create background animations, and we're looking at 180-200 sprites on screen. Thankfully, this game is turn-based so these sprites aren't all moving in real-time.

I intend to make the game as flashy as possible while minimizing the amount of sprites that are 'doing nothing'.

Now, I'm not sure what the performance gains are on not having sprites vs. making sprites invisible, but maybe @Ashley (or anyone who is knowledgeable on this matter) can explain whether the performance gains caused by removing sprites altogether (as opposed to making them invisible) is going to make a difference.Excal2013-08-08 23:21:31
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 09, 2013 6:03 am

Performance impact is non-existent like I said, would not worry about that.
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Fri Aug 09, 2013 6:06 am

@vee41, I've read up some more and invisible sprites actually seem to do nothing to performance, so you are right.

I'm having issues replicating your array method, as it seems like every spot in my array is getting the same value for some odd reason:



I tried to convert your array code to work for my program. The catch is that yours checks the animation state, mine has to check if a sprite is invisible (as opposed to animation state), and whether there is a program sitting on it (I don't destroy the board spaces when a unit is placed on top of them, as the units exist on a layer above them and have the appearance of 'sitting' on the board spaces).



Any idea why I'm getting the same array value every time?
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 09, 2013 6:51 am

It seems you first pick an empty space (the top left one), then try to pick some more after that. That won't work, as you have already narrowed the selected objects to that single tile, so you can't pick outside it.

Move the loops up one level, so you won't have the top left emptyspace picked when starting the loops.

It also seems odd that you have this in a group. Function would be much more fitting and easier to use in my opinion. :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Fri Aug 09, 2013 7:10 am

@vee41, I've moved it into a function, which is now called at the start of the player's turn. I'll fiddle around with the updating as I flesh the game out further.

I'll start working on the grid display next :)
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 09, 2013 10:53 pm

@vee41

I noticed in your highlight move function, you check whether the space is invisible or not in the array. However, my program has an additional complcation: units on the board can take up more than one space (their 'parts' can occupy more than once space). In my array, if a square is occupied by a program, the UID of the program is stored in the array.

To check that the square is also not being occupied by a program, would I have to run a loop to see if some Program.UID (they're all in a family) does not equal the value stored at that location in the array? Or does one line of family.UID = Array.Value automatically check for the UIDs in the family for a match?



Complicated question, I know :(Excal2013-08-09 22:54:25
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Sat Aug 10, 2013 7:59 am

I've checked the array in the debugger. The function to create move point should be firing since the extra clause mentioned above is not an issue when all the programs are sitting on their spawn points and only occupy one space.

However, I'm not sure why they're not showing up:



The highlight code is exactly the same as vee41's (his example works 100% perfectly):



I think the problem lies in the actual function call:



I have the spawn highlighting section hidden because the highlighting is clearly working. I'm not quite sure what is wrong.Excal2013-08-10 08:00:48
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Sat Aug 10, 2013 2:18 pm

So you essentially want your play tokens (programs) to block movement, or did I misunderstand? Anyways, I added that functionality to my example. :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: bambang150, conker23, Janaina, LaurenceBedford, lucaralho and 6 guests