FroddeB's Forum Posts

  • 6 posts
  • A much more sensible way to do this is to only spawn bullets if the variable is >0

    I feel stupid. I could do all this and somehow make it work, with a minor problem. Though the answer was so simple. Thank you!

  • It seems like you are using instance variables. I would say in this case use global variables instead, since their values can be compared and edited in the event sheet. Thats how I make my playerHealth, Ammo, Currency, Etc. Work.

  • So right now I am making an ammo and reload system, while making it I saw there was a problem with the bullets my player was firing. When "playerAmmo is equal to and less than 0" then "Destroy the object, Bullet". This is in order to make sure that when you keep clicking without ammo the Bullets gets destroyed immediatly. Now my problem is that when you have fired multiple bullets and they are visible on screen the playerAmmo hits 0 and destroys all bullets instead of the latest one. Anyone who would know how I could destroy the latest bullet instead of all bullets at the same time? Thank you!

  • I will note that if your enemies should never stop moving, bullet behavior may be more efficient.

    Though you can combine that with Turret...

    Here, I made a .capx!

    Ah thank you! This really helped me out!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I actually do something similar for touch controls using 8 direction. Same principle.

    Pick a threshold (it will be an imaginary bounding box) for how close the enemies can get to the player. Say, if they get within 40 pixels of the player, they stop progressing. Otherwise, they keep moving.

    This is simple to set up. In this case, we decided threshold = 40.

    If player.X>enemy.X+threshold, simulate control "move right" for enemy.

    If player.X< enemy.X-threshold, simulate control "move left" for enemy.

    If player.Y>enemy.Y+threshold, simulate control "move down" for enemy.

    If player.Y<enemy.Y-threshold, simulate control "move up" for enemy.

    It will then move up, down, left, right, and any combination of those directions until it is within your threshold (40 pixels here). That way, they won't bunch up and overlap the player. You can have whatever offset you want.

    This seems like exactly what I need! Though how does the player.X>enemy.X+threshold work in event sheet? (Sorry if I am being tedious I am just trying to learn new things in construct 2 which could hopefully help me later.)

  • So at the moment I have the enemy events set up correctly to make the player loose health. Though I was wondering how I would make the enemies move towards the player using 8Direction movement?

    Would I set actions "angle toward (player.x, player.y)" and "Set 8Direction speed to 80" to an "enemy is on layer 1" event? I tried this, it did work although every time I was going towards the enemies they were going backwards and sliding across the level but always looking at the player (Or more specific they were sliding the direction I was walking). I have the settings setup so the screen follows the player. Thank you!

  • 6 posts