JosepM's Recent Forum Activity

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

  • Try Construct 3

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

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

  • 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?
JosepM's avatar

JosepM

Member since 24 Feb, 2014

None one is following JosepM yet!

Connect with JosepM

Trophy Case

  • 10-Year Club
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

12/44
How to earn trophies