I'm blocked

Get help using Construct 2

Post » Wed May 14, 2014 6:05 pm

Hi @Dutoit,

I test your example and is good, but the problem I see is that my regions are each one a sprite, my map is a colletion of sprites and no instances of the same sprite, so how can I refer to each one from inside the repeat loop?
For the chips stats and others elements that can be instances is very good.

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

Post » Wed May 14, 2014 7:36 pm

@JosepM
Bundle them up using families. And assign instance variable to families...
So for each families...
condition: instance variable bla bla
etc etc


Edit:
You need to make use of of entire toolset, from families to containers. and instance variables. With turn based and movement you have to keep track of lots of data, so you need more tools for the job.
I'm all ears for simpler way. When you start moving pieces, having pieces overlap others, having multiple players, and tons of sprite objects. Instance variables are the only way I can safely assign unique data to various objects.
With a unique id and data, you can then save to array/dictionary/ and ultimately to webstorage (save points)

All ears if you come up with simpler solution - shrugs.
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 15, 2014 7:33 am

@JosepM
Afterthought:
You say you got lots of objects(images) for each piece of map etc.
You are adding those pieces to frames right? Object Sprite called world map, and each frame is country etc.
So all under one sprite object which has instance variables. You drag image and set the initial frame...
select frame.JPG

That way you can have map with multiple frames of individual pieces. etc etc etc
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 » Sat May 17, 2014 12:53 pm

Hi @Dutoit,

Nop, my initial approach is create the map with many sprites where each sprite is a region, country, etc.. and each frame show the region selected and with some colors of each faction.
As you said me, group all the region sprite into families permit me loop to select automatically the destinations from the selected region and as you said before load from a JSON into an array to control it.

{"Z1":[2,6,7],"Z2":[1,3,6,7],"Z3":[2,4,6,7],"Z4":[3,5,6,7],"Z5":[4,6,7],"Z6":[1,2,3,4,5],"Z7":[1,2,3,4,5]}

But the array don't recognize the JSON array. Is correct? or I missing something?

How handle it from one worldmap sprite?
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Sat May 17, 2014 1:28 pm

Code: Select all
{
"c2array":true,
"size":[6,5,1],
"data":
[
   [   ["Z1"],      [2],[6],[7],[9]            ],

I don't know why, but C2 requires the "c2array":true part etc.

Best bet is to create array using c2, then download it on start of layout. THen check the downloaded file as frame of refrence.
One big map... I used image points, which can be effective. But breaking it up like you said is also good.
Done both ways, each with pro's / cons.
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 » Sat May 17, 2014 3:30 pm

@Dutoit, I have different points inside the region sprite to show status, clan owner, resources, then from the loop I can update all.

How show you to the player for example the owner of each country? or the momevent?

Create the array using C2, where? I don't see any option, how can I export or extract the file one time is into the files folder?
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Sat May 17, 2014 9:00 pm

@JosepM
Did a small tutawhile ago for someone else.
Below attached a modified version - Push blue button will download the json file. To get format.
I create a number of json files and add them as project files and use ajax to pull them in.
Makes easier editing as you can then edit the json files directly.

How show you to the player for example the owner of each country? or the momevent?

Pieces overlapping zones could show who owner of country.
Or count how many pieces he has, if he has more than other player and is overlaping country X, then he has dominaince over that area. You could create instance variable "DominatedBy" and list the players id or something similiar.

You are going to have to play around with what works best for you, and what your skill set allows you to handle. Keep it simple stupid always seems the best route.
Dragable pieces. And using overlapping. and storing data to variable instances.
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 » Sat May 17, 2014 9:43 pm

Hi @Dutoit,

Yes, I found it and I was playing with it about populating the card. It's very interesting. I will try now with this and report my steps.

By now I tryed this but I can't put into the X dimesion.

{
"c2array": true,
"size": [
7,
5,
1
],
"data": {
"Z1": [
[
3,
2
]
]
}
}
B
18
S
2
G
2
Posts: 64
Reputation: 1,220

Post » Sun May 18, 2014 8:21 am

The above is xyz
7 x
5 y
1 z

That is why I said use c2 to make your array. THen download it as json. Then use the ajax to load the json file into array. It is a long way round, but it saves you in the end.
I actually have a build data array event sheet which I disable(don't include it), but keep around for later use.
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 » Sun May 18, 2014 9:03 am

Hi @Dutoit,

I guess I have the trick.

Code: Select all
{"c2array":true,"size":[3,5,1],"data":[[["Z1"],[2],[7],[6]],[["Z2"],[1],[3],[6],[7]],[["Z3"],[2],[4],[6],[7]]]}


With this array I can get the values myArray.At(0,3) & " " & myArray(1,4) myArray.At(2,3) with the values 6 7 6. This is OK, but I'm on two dimension array, isn't? So If I put "size":[3,5,0] the values don't work.
Is mandatory define one dimension for the Z?

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

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: rayolf and 10 guests