CJacobsSA's Forum Posts

  • Hi, I'm making a game a top-down 8-direction movement perspective. One of the basic AI systems most of my enemies have is one that allows them to follow the player, it's a very simple implementation with no frills, just "if the player is here, simulate movement in this direction" like so.

    (obj_legs is my player's body hitbox object)

    The problem is, when they align with the player on the X or Y axis, they constantly switch between up/down or left/right, causing this weird slow and jittery movement. Is there a better way to do this real simple AI that would prevent that?

  • Excellent, that works just fine. Thank you!

  • I'm creating a game that has rooms sort of like a zelda dungeon, and I'd like to make pickups randomly spawn in the room the player is currently in. Each room is surrounded by a plain box called obj_spawnzone:

    (visually represented here in stunning HD)

    What I'd like to have happen is, every 1-10 seconds, a pickup spawns at a random position inside obj_spawnzone. The first part I've got with an "Every round(random(1,10))" event, but how do I spawn the pickups at a random position inside the object? Keep in mind that I don't want pickups to spawn in rooms the player isn't in.

  • I'm creating a game with a whole bunch of different room layouts that repeat many times, and the bounding box around the edges of the rooms changes based on whether or not there's a door on each wall. Here's a quick example:

    Since it's a bounding box, only the red parts are opaque. All of the white would be blank, transparent space.

    As is, each wall uses at least 4 different instances of a boundary wall object that is solid (up to 8 if there's a door on each wall). I have to set the lengths and positions of each boundary wall by hand and it's just a big hassle that takes a lot of time, so I spent some time brainstorming a better way.

    I got the idea that maybe I could use one bounding box object, with each different type of box being a frame of an animation for it. That way I could define each instance easily, instead of manually putting together each wall by hand. The only problem is, I can't figure out how to make only the opaque part (the walls) be solid, while the transparent part (inside the walls) stays walkable. Is it even possible?

  • Hello, I am sad to say I'm pretty much in over my head here. I'm trying to make rooms for my arena shooter game (think Smash TV), where the player enters the room, a number of waves of enemies spawn, and the player exits through one of my pre-set points when they're all dead. I've found a wave spawning system that works perfectly, with one fatal flaw: The spawn boxes move with the camera as they should because they're on a 0 parallax layer... but the enemies still spawn at their original spots. Additionally, the zone ID instance variable controls what spawns in each room, but it doesn't update upon moving between rooms. I could use some help with both of these issues because I've got no idea what to do.

    Here is a download link to my CAPX file. Use WASD to move and arrow keys to shoot. Move all the way to the right side of the screen to switch from the first room (zone ID 0) to the second room (zone ID 1). In order to get the wave to spawn in the second room, you have to move outside the layout and move back in.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah-ha! I figured I was missing something like that. Thank you for the help, it works just fine now.

  • Same deal, unfortunately, but the issue now isn't with your solution (which I imagine does work):

    The way I have my actions set up, the game checks it for false and sets it to true, and checks it for true and sets it to false, at the same time. Which results in both guns firing at the same time. What's the proper order of operations to keep it from doing that?

  • In my game, the main character is able to wield a gun in each of their hands. I would like to have it so that the guns alternate firing, instead of shooting at the same time. Here's a rudimentary doodle to show what I mean.

    I'm stumped on how to accomplish this. I can make both guns fire at the same time at the end of a countdown, but how do I make the guns alternate? I want them to shoot at the same firerate, but if I give them each a separate event with the same cooldown they obviously still shoot at the same time. It's making me feel like a real dummy!

  • That works! Thank you for all the help.

    I'm still a bit mystified as to why your fixes worked so if anybody can shed some light on that feel free, but other than that, I have no more issues at the moment.

  • Ahh, thank you! That's also very odd, I don't quite get why the 1*dt was making things go screwy. The only trouble now is that when multiple skeletons are in range, they all attack at the same time, which I was trying to keep from happening (unsuccessfully, as we've seen ). It subtracts from var_attackcountdown at the same time for every skeleton, instead of subtracting on an individual basis. Any ideas?

  • You're right, removing the line of sight stuff from the 'for each' event fixed everything. Weird! Thank you for the help.

    I am having another logic flaw issue that I can't untangle that maybe you could help me with as well. I have a state for the enemy attacking that creates a hitbox every time a countdown variable reaches 0 (along with setting the enemy to the attack animation):

    It subtracts 1*dt from the countdown whenever the enemy's state is 6, and at 0 the attack happens and it resets to 1. In theory, this should work for each skeleton individually since it's under the 'for each' event.

    But it doesn't. When more than one skeleton is in range at once, it creates dozens of hitboxes at once even though I have those 'trigger once' actions set. At 3 skeletons it stops subtracting from both their countdowns. As more skeletons come in range it gets even more broken. What am I doing wrong now?

    https://www.dropbox.com/s/jpn6loz49rm41 ... .capx?dl=0

    Here is the updated capx file for you to fiddle with.

  • I managed to fix the problem by removing everything from the 'for each' event. I've got no worldly idea why that worked, because I thought it had to be inside the 'for each' to work on an individual basis, but it did! If either of you would like to take a look at my capx and help me figure out why (which I'd definitely appreciate), here it is:

    https://www.dropbox.com/s/jpn6loz49rm41 ... .capx?dl=0

    Use the arrow keys to move. Skeletons should aggro on you individually when you come within their LOS range variable.

    edit: I should also note for posterity that the sprites aren't mine, they're from Castlevania, they're just there as placeholders until I bring in an artist to help me (I have no artistic talent whatsoever).

  • Hi, I feel like a real dummy right now, I'm having trouble figuring out why my code isn't working and I could use some help.

    Here is all of the movement code for this enemy. When they have line of sight with the player, their state changes to 3 if the player's on their left and 4 if the player's on their right. If they don't have line of sight, they randomly choose a behavior between 0 and 2 every couple seconds. This works perfectly! ...For the first enemy I plop down. Any more enemies I put down do not follow this behavior and don't move at all until the player enters their LOS. They also do not lose sight of the player upon leaving their LOS.

    What am I doing wrong here? Again, the first enemy I plop down on the layout works exactly as I'd like it to including losing the player upon exiting its LOS.

    edit: Also, when one is alerted, the awareness marker appears over all of their heads instead of just the alerted one.

  • Just an update on the situation, I have figured it out, I think.

    This works just as I'd like it to! However, if there is a better or more efficient way to do it, feel free to share it here. I'd like to cut down on the clutter if at all possible.

  • Fairly simple question that might end up having a complex answer, I dunno for sure. I'm looking to create a dash effect for my game a la Mega Man X, but with the player unable to change their direction of movement while dashing. Ideally, what I would like is for the player to speed up when the dash button is tapped while moving in a direction; the player moves at an accelerated pace in that direction for a split second (unable to turn around), and then goes back to their default movement speed. The trouble is, I don't know how to do any part of that. Help would be appreciated!

    edit:

    I managed to bumble into creating a dash move successfully, my code is... more than a bit messy, but this works as a starting point. Now that I've done that, how do I make it so the player cannot turn left while dashing right, etc? I've tried ignoring player input and simulating the control when the player is in the "dashing" state, but that just stops them in their tracks.