JosepM's Forum Posts

  • DUTOIT thanks for the advice, I just buy it

  • OMG! I can't belive! It's it's ... the template is functional out of the box?

  • Works fine!

  • Wow It's very cool!

  • Hi,

    I'm using VMWare with my Mac and work perfect!

  • Hi DUTOIT,

    Yes, the button is only for testing the calls to functions on this prototype. Thanks for your advice.

    Edit: To use the "IndexOf" for the X only in 2D array or 3D array? is posible or search for the entire array?

    Salut,

    Josep M

  • 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

  • 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

  • Hi DUTOIT,

    Attach the .capx

  • Try Construct 3

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

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

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

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

    ]

    }

    }

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