I'm blocked

0 favourites
  • 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?

  • 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.

    [quote:32r39d5i]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.

  • 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 ]

    ]

    }

    }

  • 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.

  • Hi DUTOIT,

    I guess I have the trick.

    {"c2array":true,"size":[3,5,1],"data":[[["Z1"],[2],[7],[6]],[["Z2"],[1],[3],[6],[7]],[["Z3"],[2],[4],[6],[7]]]}[/code:z3wo719s]
    
    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
  • Yes, it is just the way it works.

    X = width

    Y = Height

    Z = depth

  • 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

    (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
    [/code:329ijiwh]
    
    From the touch of each zone I call the function.
    
    [code:329ijiwh]
    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
    [/code:329ijiwh]
    
    Thoughts?
  • 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...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • Hi DUTOIT,

    Attach the .capx

  • 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.

  • 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

  • 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.

  • 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.

    [attachment=1:7w1od07p][/attachment:7w1od07p]

    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.

    [attachment=0:7w1od07p][/attachment:7w1od07p]

    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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)