ThomasP's Forum Posts

  • CurrentLevel is a global variable

  • I have mine as sub-events.

    Mouse -> On Left button Clicked

    System -> [variable name] = 1 ..... here are events for that

    Else

    System -> [variable name] = 2 ..... here are events for that

    Note, you do need the "Else" condition for the second sub-event and beyond. And to get to the variable name part, it's called Compare Variable after you select the System event.

  • At first I had it just on the first level on the game layer (not global) and not on the second level. Spawning it at the exit wasn't working, so I'd have a sprite on the first level but not the second. Then I tried having the sprite on each level and now at least you can play each level, but it isn't spawning in the correct location except for the initial load into the first layout. Subsequent loads into that layout start where the sprite is placed, not where the exit is.

    Does that answer your question? Sorry, my mind is fried right now after work.

  • Here's a screenshot of what I'm doing:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could have their choice affect a variable and then the events in the layout rely on that variable. For instance, if you press the left mouse button, the game checks the variable to see what weapon is equipped, then based on that it fires a different type of bullet.

  • Create a layer for the UI and set its parallax to 0,0. Add the alert sprite to that layer and set its visibility to false. When the alert is triggered, have it set the sprite's visibility to true.

  • You can add conditions to the event. So:

    Every Tick

    Mouse.X > Cannon.X

    I think that should work. So the game only does the action if the mouse is higher up on the screen that the cannon. You might have to reference the cannon's origin image point, though.

  • Is it rotating around the center of the sprite? I forget what Construct 2 uses as the basis for its rotation, but it might be the Origin image point. Double click the sprite to open the sprite editor, then towards the bottom left there is an icon that opens the image point editor (when it opens, you might have to move some windows around to find it). You can move the Origin image point (image point number 0) to wherever you want the sprite to rotate around.

  • Double click in the layout and add the Mouse object so it can be used in the game. Now it should appear in the Auto Complete and you should see it in the list of objects. You only need to add it to one layout and it is added automatically for the entire project.

  • I'm having trouble getting my player sprite to spawn correctly.

    The set up is like a multi-room house where each layout is a room. If you walk to a door it changes layouts to the room you walked to. Each room has multiple doors, so when it loads a new layout the game should spawn the player sprite at door leading to the room you just exited.

    Here's what I tried: I have an exit sprite with an instance variable called "LeadsTo" that has the layout name that it leads to. When the player sprite collides with the exit sprite, it calls a function that uses that instance variable to know which layout to load. That part works fine. In "On Start of Layout" I have it spawn a player sprite at try to position it on the exit sprite that has the instance variable with the same value as the layout that the player just left. Nothing is spawning.

    I'm not at a computer with Construct 2 right now, so I can't show exactly what I did.

    Anybody have any ideas? I can't make one layout cover all rooms because that is just an example and was the easiest analogy for what I'm trying to accomplish.

  • Every Tick, set angle of cannon to position (Mouse.X, Mouse.Y). I'm not in front of a computer with Construct 2, but I think that's what I did for my top down shooter character to always point at the mouse.

  • Ahh, I see. Thank you for that link. I wasn't aware of that.

  • I tried that, but it was selecting all ships, not just the one in the same container. Thank you for confirming what I thought it was supposed to do, though. Maybe I'll set that up again and see if I can find something else in the code that is causing the problem.

    Would it make a difference that all the gun turrets are in a family and all the ships are in a family? So it actually has the gun turret family has a target, then the ship family bullet speed is set to ...

  • I have a gun turret with the turret behavior in a container with a ship that has the bullet movement that is used for basic movement. When the turret has a target, I want the bullet movement of the base to slow down, then if there aren't any objects in range, I want it to return to the normal movement speed.

    So basically, how do I select one container object when something else in the container has a special condition met?