mutajon's Forum Posts

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

  • dop2000 Thanks! your solution worked:)

    Ashley

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

  • So I'm trying to achieve the following behavior:

    -subtract 1 from variable X

    -update text that displays variable X's value

    -wait 0.5

    repeat the above steps for Y times. when I enter any value of Y (e.g.27) the behavior I get is a one-step subtraction of Y from X (instead of subtracting 1 each time, until Y-worth of 1's have been subtracted).

    I get the exact same behavior when using 'repeat' instead of 'for'.

    Can one not use 'wait' inside loops? If so, how to achieve desired behavior?

    can anyone shed light?

    Thanks! :)

  • So I've set an instance Boolean to be changed on mouse click, but it always becomes inactive (conditions referring to it do not trigger) and in the variable screen the Boolean designation is crossed out (see pic).

    What's going on?

    Thanks!

  • Thanks!

  • So I have a coin and the following logic:

    if coin overlaps tile (which it does in the attached example), wait 2.5sec and flash coin for 1 sec.

    What I get:

    system waits 2.5 sec, then sets the coin visibility to false...

    What's going on here? What am I missing?

    Thanks a ton!

    the file:

    we.tl/t-CaiiolyJZw

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So I have an array of integers, and I want to make sure no two numbers within the array are the same.

    If they are the same, change one of them to something else and run the check for duplicates again (until there are no duplicate numbers).

    Any ideas on how to implement that?

    Thanks a ton! :-)