DrewMelton's Forum Posts

  • What did they change in the new release? How is it different?

  • Well, this has already been pushed back to page 3.

    The only solution I have come up with is to use multiple families, and in each one have a different sprite entirely (even though it's the same enemy type).

    So, it'd be like warrior1, warrior2, ninja1, ninja2, etc. Each with their own sprite.

    For example:

    family 1: warrior1

    family 2: warrior2

    Etc.

    So, it'd be more code to write, but each spawn area would only spawn from its list of enemies. So, warrior1 could only spawn from family 1. Then, there would never be a duplicate and I can still have it be completely random.

    Does that sound good guys? I was unable to come up with another way, possibly due to my lack of coding skills and inexperience with C2, but this looks to be the easiest way. What do you think?

    Of course, there are going to be maybe 10 to 20 spawn points per level, so I don't know how well this is going to work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I originally had it set to system > create, rather than object spawn another object. And I had some coordinate ranges typed in.

    I'm still not sure which one I will use, but either way, I need to get the issue sorted out with duplication or I'm not going to be able to do any of them.

  • You could use an Array with the numbers to define each enemy, and when that kind spawns you remove that number from the Array.

    Are you using different Sprites for each enemy? Why don't spawn the Sprite instead of using the Family? Then you will be sure to spawn them only once.

    Well, I've been at it all day, and I'm still stuck.

    I tried telling it to spawn individual sprites, but I'd have to use an instance variable or something to tell it if that object has spawned. Unfortunately, C2 would not allow me to use "on created" as a variable. I set it to start at 0 and then change to 1 on created, then put as a condition to spawn it had to be at 0. All that accomplished was that it never spawned ever.

    I tried using arrays, but I still don't understand them. I have yet to find a tutorial that specifically relates to spawning items using an array. They are either basic tutorials that don't cover what I want or too complex for me to get what I need out of them for this purpose.

    I tried setting the value of x in the array to 0 in each cell, then changing it to 1 when the object was created, but I ran into the same problem as before. It would not create the enemy ever. I tried deleting the cell, but I don't know how to associate the cells with the enemy properly it seems.

    Can someone help shed some light on how to do this? All I want is a random enemy to be spawned, but never two of the same one.

  • Hey hey!

    part12studios , I think i have some good news! :D

    It might be messy and needs optimisation, but.. Here, catch the capx!

    Hope that helps!:) I'll be glad to answer any questions. <img src="smileys/smiley9.gif" border="0" align="middle">

    Your capx is asking for a password.

  • Yeah, each enemy has its own sprite and separate hitbox. They are in containers so the hitbox is created with them and pinned on creation.

    I'm still new to C2, so I've never used arrays. I'd have to look into how to do that. If that's the best way to go, maybe someone could give me a little help.

    The main thing I want to make sure is that it's still random.

    So, if I spawned sprites instead of families, how would I make sure that they could be spawned at any of the 20 spawn points, but never be picked twice?

  • Okay, I think I'm running into another problem here with my platformer.

    I have set up some random spawn points.

    The enemies are set to spawn once when the layout starts. There is a 100% chance that one will spawn, and the other only has a small chance of spawning.

    Here is the function I used to create the spawns:

    I'm going to try and spawn maybe 15 to 20 enemies in a single level, so I will place multiple spawn boxes each as a different sprite with different code. The example above just shows the first 2.

    Now, the problem I think I'm having is that if 2 or more of the same enemy spawn, they will share the A.I.. In other words, they are both acting as one unit.

    I need to make sure this doesn't happen because the A.I. is quite advanced. It will attack, use line of sight, etc. So, I can't have two of the same sprite/hitbox interfering with each other.

    Is there a way to set it to prevent more than one of the same unit from being spawned at the various spawn points? Otherwise, I need to find an alternative way to do this.

  • Create hitbox (if the enemy is in a container the enemy will be created too)

    Enemy on created - pin to hitbox

    That's what I was looking for! Thanks.

    I had to also add an event to set the position of the enemy to the hitbox, and I had to adjust the origin point of the hitbox since it was off.

    It seems to work now. :)

  • I was thinking about creating random enemy spawns in the game (which is a platformer type game).

    However, I keep running into problems.

    Now, the enemy is fine if I manually place him. He is pinned to his hitbox at the start, and all is well.

    However, when I have the game spawn him at a spawn point, he is no longer pinned to his hitbox.

    I moved the enemy outside the layout and set him to destroy outside layout so he wouldn't interfere.

    I put the enemy and the hitbox in a container, and they both do spawn. They just aren't pinned. The enemy is stuck in place while the hitbox chases me around.

    I created the random enemy spawn by an event with system > create family (enemies) at a specific location.

    I don't know how to get the enemy pinned to the hitbox after he spawns. I already have code that was supposed to pin them (on start of layout, pin enemy to hitbox).

  • Aurel Actually, I was the one who said I was a bit miffed, and I wasn't even being all that serious, lol.

    I just meant that it's a shame that Gamemaker got Steam support and C2 didn't when C2 is by far the program I want to work with. I doubt I would be anywhere as far if had bought Gamemaker instead.

    As someone who really wants to focus on PC for my first game, I am really anxious to get things on Steam when I get the game done.

  • Thanks, I got it sorted.

    I forgot to mention it was a platformer. I guess I was tired.

    Anyway, the real trick was the placement of the "else."

    I had to put it in the middle of the two like this:

    system - compare npc.x > player.x + 225 = look left

    else = look forward

    system - compare npc.x < player.x - 225 = look right

    When I originally had else at the bottom rather than the middle, it would overwrite the look left command. I have no idea why. It seems like else would work regardless of placement, but I guess not.

  • Ah, okay. In that case, I hope this gets as much official support as it can. I'm still a bit miffed that Gamemaker gets Steam support and C2 doesn't when it's by far my preferred program.

  • Just curious, is it possible to put a game on Steam without this plugin?

  • Okay, so I'm setting up an NPC that will look towards me as I move past.

    I set up three animations, one with his head looking foward, one looking right, and one looking left.

    I can easily make the person look left or right. The problem I run into is making them look forward again.

    I actually did accomplish this, but I had to use trigger boxes. I set it so if the player is overlapping them, it sets the NPC's look animation. I have one for left, one for right, and if overlapping neither to look forward.

    However, that method will add to the object count, and is not the optimal solution. That and I have to add these trigger boxes (sprites) in with every instance of an npc.

    I wanted to do it with code. You know something like compare x. I had it working, but I couldn't get it to work with looking forward. I tried using "else." I tried using inverts. And so on, but nothing worked. It always either didn't look forward at all, or it ended up overwriting the look left command or something.

    Also, I set it up so there is some play. I added +200 for the right, and -200 for the left so the NPC would look forward when you start to get close rather than when you are on top of him.

    I'm using playerHitBox as my main thing in the events. So, if my hitbox is to the right or left, it makes the npc look.

    Ex: (X < npc.x -200) or (x < npc.bboxleft -200) to look left

    or (X > npc.x +200) or (X > npc.bboxright +200) to look right

    Can anyone give me some guidance on what to do to make him look forward in between all this? I can't do it without interfering with one of the other directions. Thanks!

  • I plan on releasing my game on Steam, so I am definitely going to check this out, and I hope it gets as much support as it can.