Xavier's Forum Posts

  • Make sure the tiles are not set to global in the object properties. Otherwise the problem might be in your events if you are creating the tiles manually.

  • You probably need to add the "trigger once while true" condition, otherwise it keeps repeating this event every tick and picking a random instance every time.

  • You need to use the action Simulate Control instead of changing the angle.

  • The game already has movement behaviors, that's why I asked. Did you try those? Specially the 8 Direction behavior. You can simulate the controls with whatever keys you want.

    Are you using the latest version of C2? Does that error happens with all browsers? It doesn't happen to me.

  • Is there a reason why you are using your own method for the movement?

    About the animations, the problem is that you are setting the animation to neutral every tick with an event inside the MeMovement group. This probably worked before because you had the events arranged in a different order, but since you have this one first, it takes priority over the events that control the other animations. If you don't want to change the order, just create a condition on the neutral event that says "if keyboard key D isn't down" and repeat this condition for each movement key.

    For the bullet, you need to create an instance variable on the character (call it player_angle for instance), and when you push a key to change direction, change that variable to the right angle (if you push D, set the angle to 0, if you push S set the angle to 90...). Then after you spawn the PBullet, change it's angle to the player_angle instance variable.

  • Yeah, Else seems to work. Instead of the onOffToggle = 1 use and else condition.

  • I've run into this problem a few times, I think basically both events are run at the same tick so the switch is turned on and off instantly. A quick solution is to add a wait action of 0.01 before changing the variable.

    It's also important to check the "Static" box for the local variable if you use local variables for this, otherwise the value is resetting every tick.

  • Yes. You need to use the random() expression, you would use it like this: round(random(2,4))

    The round expression will round a number, so if you get 4.2, it will show 4. More on: https://www.scirra.com/tutorials/77/nat ... onstruct-2

    You should create an action at layout start to set the instance variable for the blocks to round(random(2,4))

    Modify the numbers as you see fit.

  • Maybe you can find something useful here:

  • See if this helps you:

  • Use the same mechanic, when arrow collides with wall, add 1 to global variable. Instead of adding 1 when you shoot it.

  • Use the "On Destroyed" condition on the bullet. Add 1 to the global variable when a bullet is destroyed. And when a bullet hits a target, reset the global variable to 0.

    Make sure you destroy the bullets when they hit a target, wall, or are outside of the layout.

  • You should use instance variables for this. https://www.scirra.com/manual/73/instance-variables

    Create an instance variable for the block and set it to 2 or 4. Then when the player collisions with the block, subtract 1 from that variable. And if the variable is less than 1 destroy the block.

  • You're welcome.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In this simple example a sound will play when the number is 5. You can modify the minimum and maximum numbers to randomize with the first action.

    You can also modify it in a number of ways, for instance if you use a big range to randomize, you can keep decreasing the maximum range as time passes so the chance to play the sound will keep increasing with time.