I'm blocked

Get help using Construct 2

Post » Sun May 18, 2014 9:36 am

Yes, it is just the way it works.
X = width
Y = Height
Z = depth
You do not have the required permissions to view the files attached to this post.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon May 19, 2014 10:28 am

Hi @Dutoit,

Now I have the first loop working. Attach screen capture.

But the second one I have no idea how insert it.

Array example
Code: Select all
(0,0) Z1
(0,1) Z2
(0,2) Z3

Destinations for Z1
(1,0) 2
(2,0) 3
(3,0) 5

Destinations for Z2
(1,1) 1
(2,1) 6
(3,1) 7

Destinations for Z3
(1,2) 1
(2,2) 3
(3,2) 7


From the touch of each zone I call the function.

Code: Select all
function SelectZone (pZoneID)

repeat for each Zone // Where the ZoneID is the X (0,currentY)
    if Zone of the array=pZoneID // We found the Zone
           repeat for each Zone // where is the X (currentX, the Zone ID)
               change frame of the sprite


Thoughts?
You do not have the required permissions to view the files attached to this post.
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Mon May 19, 2014 2:27 pm

Hi @Dutoit,

Attach new screen capture with the repeat inside repeat...

The problem is that I don't see how repeat only for the local stored X.

Any idea? I'm close to solve it...
You do not have the required permissions to view the files attached to this post.
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Mon May 19, 2014 3:12 pm

@JosepM
Sorry been a busy day.
What we trying to do again. Sorry been a long long day :(

Why you looping through it twice?

Edit: Sorry, my mind is on multiple things, can you put demo capx? with what you trying to do. So I can re aquint myself with what you trying to do? And helps because I don't have to build it to test certain things.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon May 19, 2014 3:38 pm

Hi @Dutoit,

That I try is to loop through the destination zones and change the frame assigned.

Array sample
0: Z1, 2,3,5
1: Z2, 1,5,6
2: Z3, 2,2,4

With the first loop I found the "Zxx" store into a local variable to fix the Y and loop through the X axis.
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Mon May 19, 2014 5:57 pm

Hi @Dutoit,

Attach the .capx
You do not have the required permissions to view the files attached to this post.
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Mon May 19, 2014 6:23 pm

@JosepM

Will look at it ;) and post back a bit later.

I'm trying to think down the road, so that is why I am trying to understand the bigger picture.
Already you are creating repetitive code. You need to streamline the process.

(pc, mobile, or both?)
Be careful of every tick. You can change those when they need to change, not every second....

Let me have a look... will post back when i get a chance.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon May 19, 2014 7:51 pm

Hi @Dutoit,

Initialy Desktop and tablet.
Yes, I see the repetitive code, then the idea of manage it from arrays and perform the basic operations with repeats.

I the last .capx I create a new function that change de frame with two params, the zone and the frame.
These function must be called inside the repeat for the destinations.

Salut,
Josep M
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Tue May 20, 2014 10:02 am

@JosepM,

I don't see the bigger picture of what you are trying to do, but I spent a bit of time trying to come up with best way forward.
I still stand by that you should use containers and single sprites to store data with frames of zones.

Anyways, this is a basic mock up. i can't spend anymore time on this as it is starting to eat out of my billable hours (this week is crazy busy - sorry).
So, It is really a mock up, and not perfect. I did a number of mock ups - testing various ways(so many ways to do same thing).
THis offers greater options in my opinion (and my opinion isn't worth much, as I can't see the bigger picture of what is in your head)
Anyways, hope this helps you a bit. Of course it might be completely wrong. I have "Risk" in my head so I am thinking "Risk".


Each section gets numbered.
Each section gets zoned (if you want to group more than 1 section into a zone)
Each section gets named (if you want sections to be cities?)
Each section gets active (if you want to put a pulse or other effect)
With above you can create your array selecting sections by number or whatever. This offers a lot of possibilities.

Edit: I didn't put your array in. Now that each section/zone has a number you can run the array and select the destinations based on those numbers.
You do not have the required permissions to view the files attached to this post.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Thu May 22, 2014 7:41 am

Hi @Dutoit,

Thank you for your example. It's other approach that work fine but need that the zones was like a chess board to move to, in my case my boardmap it's about irregular shapes. With your examples and explanations I continue working, and I guees I solved my problem.

Captura de pantalla 2014-05-21 07.49.45.png


I created to functions that when the user touch one zones, check the array and highlight the desired zones from the array. I'm only I need to created the map, extract each zone with their frames and create the array where I put where the player can move. The same solution can be applied to the units or whatever.
Attach an screen capture with the solution.

Captura de pantalla 2014-05-20 08.03.10.png


This one example of mapboard but can be extensible to any other model.
The use of an array to control destinations, attributes, values is more easy and automatically. Now I will continue with the tokens movement.

News questions are:

How avoid the "undefined value" error when try to read one array position?
How find into an array for a value and replace it? I found "TheindexOf" and "TheValueOf"
I guess that if the search value work fine is better than the use of repeat.

Thoughts?

Salut,
Josep M
You do not have the required permissions to view the files attached to this post.
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 16 guests