mutajon's Recent Forum Activity

  • brushfe

    That did it!

    Thanks!

    Every day I learn something new about this program...

  • Really!?

    local variables constantly reset!? Do you know the logic of why this is so?

    this makes them rather limited and forces me to use global when there isn't really a need for it to be global other than this weird limitation...

  • But why does it reset?

    And how do I prevent it from doing so?

    (and it does not reset when it is global?)

  • So I have a sprite animation's frame set to a local variable, and each click of the mouse is supposed to increase said variable by 1, and thus progress the frame shown by the sprite (comic book bubble updates).

    HOWEVER, this works ONCE and then stops working.

    If I make the variable global, it works as intended...

    Why does it have to be global to work?

    The project

    Thanks for any help!

  • Thank you both so much :)

    I do need the offset, since the grid is a kind of board game, so having it start at the absolute origin (0,0) is not very practical. However, the offset doesn't have to be 'weird', it can be 100, 150 or something like that.

    I'll have a closer look at what you suggested, and report back if I still can't make it to work.

    Thanks again!

  • I'm creating a grid of tiles (the size of the grid and tile can change), and a randomly sized rectangle.

    The rectangle is always some multiplication of the tile size - for example: 3 tiles X 4 tiles etc...

    The rectangle is draggable, and I need it to behave in the following way:

    1. Always stay within the grid boundaries

    2. Move along the grid lines

    - I've sorta managed to do number 1, although there's a very jittery behavior near the edges - if anyone can help with that it would be GREAT!

    - I ripped nearly all my not-so-thick hair trying futilely to get the second behavior to work - no matter what I try, I only manage to get the rectangle to be dragged by tile-sized increments, but it is never aligned with the grid itself... and worse, this misalignment changes as one changes the screen size!

    PLEASE - help me keep what little hair I have left...

    The project file

  • dop2000

    Thanks! and how do I reference elements using scripting?

  • So I'm struggling a bit with how to make versatile functions by passing them different information types.

    For example, consider the following function:

    updateNumberAndText(x,y,z)

    step 1: add y to global parameter x

    step 2: update text element z to display the value of x

    I know how to pass the y value by using a local numerical variable, but how do I pass which global parameter (x) to change? and how do I then pass which text element (z) to update?

    (Clarification: I want to be able to change x and z every time I call the function from within the game)

    Thanks! :-)

  • Thanks for the very informative reply.

    Now I feel like I understand the wait concept much better.

  • dop2000

    from your explanation:

    Wait 0.5s

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    Add 1 to variable

    I see that the wait is executed only once, at the start, while the add action is repeated 10 times...

    How does your trick fix this? Also, how does your trick not increase the wait time between steps the more times the loop is executed?

    Also, thanks for taking the time and effort to explain! :)

  • Ashley

    So that I'll understand better when and why to use the wait action, could you please elaborate why it is executed only once when it is a part of a loop? Why do I need to use the 'trick' dop2000 suggested instead of using the regular wait action?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 Thanks! your solution worked:)

    Ashley

    but I get the same behavior even when I put the wait BEFORE the other actions (see pic)

mutajon's avatar

mutajon

Member since 2 Oct, 2020

None one is following mutajon yet!

Trophy Case

  • 4-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

6/44
How to earn trophies