linkman2004's Forum Posts

  • A more general solution to your issue would be this:

    tokenat(JSON.Value(0, 1, "Test"), floor(random(tokencount(JSON.Value(0, 1, "Test"), ","))),",")[/code:1vnqgw5v]
    Which will pick a random token no matter how many tokens you have, so long as you have at least 1 token.
  • "Stop loop" is a System object action, and will only stop loops from the System object -- for, for each, and repeat. It won't stop Array loops, since those are independent of the System object.

    I'd suggest using a variable to set and detect loop completion, as follows:

    You might also consider making an official request for a "Stop loop" action for the Array object on the general Construct 2 board.

  • Bodhran, the cursor looks to be following the mouse just fine. Perhaps you're not explaining exactly what you're looking to achieve.

    As for keeping the cursor inside the screen, you should use the clamp function when setting its position. Something like:

    Set Cursor X to clamp(mouse.X, scrollx - (ScreenWidth / 2), scrollx + (ScreenWidth / 2))
    Set Cursor Y to clamp(mouse.Y, scrolly - (ScreenHeight / 2), scrolly + (ScreenHeight / 2))[/code:1lh7nxzw]
    Note that ScreenWidth/ScreenHeight aren't expressions.  Rather, they represent the window size of your game, which you can find in the game properties panel.
  • A shame that a modern GPU won't be able to brighten 100 two dimensional sprites while it runs smoothly games with 3D graphics.

    It really depends on the GPU. My desktop can handle a couple thousand sprites with the brightness effect before performance begins to drop. Mobile GPUs, on the other hand, are notoriously under powered in comparison.

  • Two things:

    1. Effects tax the GPU, not the CPU, and most effects will give you the same performance regardless of parameter values.

    2. The only way to know how an effect will perform is to test it -- there really aren't any shortcuts.

  • The Button object already registers both mouse clicks and touch if you use the "On clicked" condition, no need for the Touch object.

  • Bodhran, you need to really look at the event sheet for the specific example you mentioned. Everything you need to get a similar movement is there, along with the points I mentioned in my previous post. I also recommend updating the file you have on DropBox with any changes you make so I can see more clearly what you're attempting.

  • Assuming acceleration remains constant, then the time from A to B should be:

    time = sqrt( (2 * (Distance from A to B)) / Acceleration )[/code:1b7tam1d]
    Which is obtained by taking the second integral of the acceleration -- 300, in this case -- and solving for time.
  • I'd suggest looking at the example that comes with MagiCam when you download the plugin, because you seem to be misunderstanding how it works.

    1. You shouldn't use the "Scroll To" behavior when using MagiCam.

    2. You need to tell your MagiCam camera which objects to follow using the "Follow object" action.

    3. You need to enable following for your MagiCam camera before it will follow anything, using the "Enable following" action.

    EDIT: For the knockback problem, keep in mind that your Enemy object is following the Sprite object, not the other way around. You need to position Sprite to the location of Enemy at the time of knockback to get them both positioned the same.

  • You're missing the ampersands after your variables. Expression should read

    "You still have " & trees & " trees and " & flowers & " flowers to fix"[/code:1leuo1ed]
  • There's no way in C2 to create an or-block like that. It seems like an arbitrary limit, and I'm unaware of why the limit exists.

    One way around it is to split your groups of conditions into separate events with duplicated actions, using an else at the beginning of each event after the first to prevent the same actions from running more than once. Another is to simplify your logic. For example, in your picture you have:

    (Platform is falling AND is doubleJump) OR (Platform is jumping AND is doubleJump)

    which is logically equivalent to:

    Is doubleJump AND (Platform is falling OR Platform is jumping)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad to hear it worked.

    I personally don't like relying on ordering of events so much as I think it can make brittle code, but whatever works for you!

    I absolutely agree, it's really not good practice if it can be avoided. Unfortunately, the triggers in subevents prevent else from working in this case.

  • "Trigger once while true" and the on key release conditions are both triggers -- indicated by the green arrow -- and you can only have one trigger per event. This is also true of subevents to events with a trigger.

  • If the else solution fails, you could just reverse the order of events 1, 3, 5, and 7. As it is now, you start a cascade effect when you set manual to 1.

  • Unnatural20, on the contrary, the four directions should cover the entire perimeter of any object, regardless of shape. The result is an approximately one pixel thick border of sorts around the object in question. Similarly, using offsets of (0, 1), (0, -1), (1, 0), and (-1, 0) provides coverage just as thorough, though the shape would be ever so slightly different.