Help with Enemy Spawn and Damage

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello everyone, I'm newish to construct 2 so I've run into a few issues. I'm working on just a demo for an idea I had for language learning. Here is my CAPX

    drive.google.com/file/d/1kIsGaGQGHGyyT3FnLxf9eg_kiiwgZq3N/view?usp=sharing

    First problem I'm running into is spawning an enemy... right now I'm not worried about movement, I just want them to spawn within a range of the spawn box. I also want it so if there is one in the area it won't spawn another one except for a random amount of time.

    Second issue is how do I get my attacks to target the enemy that is clicked on, and how to affect the health of that specific enemy only.

    Third that I don't really need help with yet is getting "wrong" answers put into the buttons without repeating. I haven't worked on that much but any suggestions would be great.

    I do apologize I'm sure my coding is a complete mess....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The first problem looks resolved as it spawns one only based on the logic. To use a range you can use random(x,y) where x and y would be the left and right co-ords of the box.

    For the second problem you need a parameter sent through the function, they are useful things. When you call a function it doesn't pick instances from the previous actions, to get around this you send the enemy UID through the function as a parameter. Then inside the function event you add a condition to pick enemy where enemy UID = parameter, this will pick the one you clicked on originally.

    For the third problem at its simplest you could use choose(1,2,3,4) which would set an answer from a choice of answers or you can look at Arrays where you can store many answers kind of like a spreadsheet and pick from them.

  • The first problem looks resolved as it spawns one only based on the logic. To use a range you can use random(x,y) where x and y would be the left and right co-ords of the box.

    It does not only spawn one though it continuously spawns. I'll keep messing with it though. I changed the enemy to a family and such since I just learned about that.

    For the second problem you need a parameter sent through the function, they are useful things. When you call a function it doesn't pick instances from the previous actions, to get around this you send the enemy UID through the function as a parameter. Then inside the function event you add a condition to pick enemy where enemy UID = parameter, this will pick the one you clicked on originally.

    Thank you!

    For the third problem at its simplest you could use choose(1,2,3,4) which would set an answer from a choice of answers or you can look at Arrays where you can store many answers kind of like a spreadsheet and pick from them.

    I was just thinking about an array so I will try to implement that. Thank you very much for the help!

  • Ah right it's because you're using a tiled background which has no collision, you should be using a sprite.

  • Ah right it's because you're using a tiled background which has no collision, you should be using a sprite.

    I'll give that a try, thank you!

  • I changed it to a sprite but it still does not work. Also I created bounding boxes but the left one does not work. I've messed around with my movment variables and the left and right but I don't think that's the problem.

    I updated the CAPX with all the changes I've made. I started expanding on other stuff while trying to figure out what was going on with the enemies.

  • You'll have to explain what you did and what is broken because that object is still a tiled background and the event related to it seems to be disabled.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)