CJacobsSA's Recent Forum Activity

  • I'm not entirely sure how to do that but I think I'm halfway there. In order for the game to know what level the player will be going to, I have a global variable called 'atLevel' which is set whenever the player box object overlaps one of the level "buttons" like so:

    How can I make it so that the game sets the player to the button that has the corresponding 'atLevel' value? Like if level 2's 'atLevel' value is 2, how would I set the player there coming out of a level? I don't have to do 'System > atLevel = 2 > Playerbox_Map > Set position to level2button' etc. for every level button do I? Is there a more condensed way to do it?

  • So, in my game I have a map screen, Mario Bros 3 style, where the player moves on a grid from level to level like so:

    The problem I'm having is that I don't know how to make the game remember what level the player is at once they enter it. If the player, say, goes to level 2 and completes it, the game puts them back on the level 1 square when they leave the level and go back to the map because that's the default position. How do I make it so that the game remembers the player's position on the map screen?

  • You can use The Litetween Behavior.

    [attachment=0:3c05jqpx][/attachment:3c05jqpx]

    Ah, this works well, thank you! I had no idea this behavior/plugin existed!

  • Hello. I have a small question I think will be pretty simple to answer.

    I made a quick test of a basic map screen and right now I am figuring out how to make the player move on a grid-based system. I have the movement figured out correctly but the problem I'm having is that I don't know how to make the player stop in the center of the node.

    Right now, the event is set to make the player stop when they overlap it just so I can make sure the movement action itself is working properly. So, how do I make it so that the player stops in the middle of the node instead of when they touch the edge of it? I will attach the .capx file so you can look at it and see if you can help me out. I'm sure the answer is simple, I just don't know what it is and can't find it elsewhere!

  • Bumping my own thread because things broke immediately after I tried to add another animation. I think I'm just gonna upload the .capx so you guys can take a look at it, because I really can't explain what happens to the game in words.

    See, now I'm trying to add another animation to the variable for "action" (formerly "Direction"). When "action" is set to "shooting", the enemies stop and fire in a straight line at the player every couple of seconds, with the animation "Shoot". The problem is that everything is ten kinds of screwy with it and I'm not sure what I did wrong!

    Here is my current code for the enemy (excluding the creation). Things to ignore unless they're relevant: The direction the projectiles go in when the enemy fires & the fact that "shooting" activating doesn't take Y pos into account.

  • Haha, wow, that was a brain fart on my end. I hadn't considered that the sprite wasn't actually connected to the box, I just figured pinning it to the box that created it would be enough! That's what I get for messing with Construct before I have my morning coffee.

    What I did to fix it was, I assigned a global variable called "EnemyID", set to 0 by default. Then I gave the box its own variable (myID_Box) as well as the sprite (myID_Enemy). Then I did the following to assign the numbers:

    And checked that the two values are equal:

    And if the value of the enemy box that hits a GoLeft/GoRight box is equal to that of an enemy sprite, the enemy sprite with the same number flips (which is, of course, true for the sprite attached to it)! Now it works perfectly! Thanks, guys!

    (Searching the tutorial section for this while troubleshooting it was a huge pain in the butt, haha)

  • Hello, I'm having an issue with creating enemies for my game, more specifically how they are animated. Since the enemies will have complex animations (running, firing their guns, standing still, etc) I created an enemy box to spawn and assign them to as I would for a player character. I gave the box the platform behavior so that it can be moved.

    (the purple 'E' box in this screenshot)

    The box has a variable called 'Direction' that controls which direction the box is facing, 'left' or 'right'. When the box collides with the GoLeft and GoRight boxes (the blue ones with arrows in the screenshot above), it turns around and goes the opposite way and sets 'Direction' to the new direction it is moving in.

    What I want to have happen is, when the box is facing left, the sprite for the enemy (the dinosaur lookin' dude in the screenshot above) attached to the box is mirrored, and when it is facing right, the sprite is not mirrored (since they face right by default).

    The trouble is that I have no idea how to accomplish that. Movement I have down pat; when I have multiple boxes they all move and correspond with the GoLeft/Right boxes properly. The sprites attached to them on the other hand, when I try to set them to be mirrored, do... er, this:

    (oh god help I'm so lost here)

    If you can't tell what's happening, the sprites are flipping around whenever ANY enemy box hits ANY GoLeft or GoRight box. Notice that the mirroring on the boxes behind the sprites is working totally fine.

    So my question is: How do I make it so that, when a box changes direction, it ONLY affects the sprite pinned to it and not the others?

  • Ah, your example cap helped me figure it out. I had events/variables for when there IS a front upgrade, but no variable for when there ISN'T a front upgrade. That hole in the logic made it so that setting the animation to frame 0 did nothing on guns that don't have a front upgrade at all. That's why the upgrade still appeared for the unrelated shotgun a few posts up, because it has no attachment to the front upgrade object. So, I did this:

    (the new shotgun 2 silencer upgrade code)

    I created a variable called "no_front_upgrade", which by default sets the animation of shotgun_front_upgrade to frame 0 like so:

    All I had to do then was make it so that, when a gun has a front upgrade, no_front_upgrade is set to 0 (as seen in the code above) when that gun is currently in the player's hand. Then, the Else statement sets no_front_upgrade back to 1 when switching weapons. If the next weapon has a front upgrade, it is then re-set to 0, and so on. Now it works perfectly! Thanks for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure, here is my .capx for the file I'm using to test game mechanics. Press 'P' to open the pause menu and click 'Upgrades' to show the upgrade buttons. Press 'C' to cycle through guns.

  • Similarly to the OP, I've got it set as an Else statement, just instead of animations I have it set to frames. Is there some other action I can use to set it back to 0 upon switching weapons or having out a weapon that does not have the front end upgrade enabled? As is, the problem is that switching to the weapon with an upgrade sets the animation to that upgrade's animation frame, but switching weapons does not set it back to frame 0, and I'm not sure how to do that.

  • Unfortunately I get the same issue (though that does save some space, thank you!). When I select the gun with the silencer and then switch to another gun, it should go away, but for some reason (a real obvious reason I'm probably missing :p) it stays visible.

    (an unrelated gun with the silencer from shotgun 2, just to show off the specific problem I'm having)

  • Hello, I have kind of a niche question. I am making a game where you can upgrade your weapons by parts and want to know if it's possible to make multiple weapons share one object for a given part, via animations. For example, I have a part called 'shotgun_front_upgrade' that is always assigned to be in front of my shotgun via image point. It has three separate one-frame animations: One for when there is no front-upgrade, one for a silencer, and one for a cork (don't ask).

    (seen here)

    These two upgrades go to different guns (both are coincidentally shotguns), but I don't know how to set the animation back to 'Blank' when the upgrade is not visible (I.E., when the player has a different weapon out). I tried using an 'Else' statement seen here:

    (the silencer upgrade)

    But this only works for one gun. If I apply an Else statement to another gun, they override each other if the upgrades are enabled at the same time.

    |

    (for example, here is shotgun 2 with the silencer upgrade, shotgun 3 is on the right with no upgrade selected)

    |

    (upon enabling shotgun 3's upgrade, the Else statement applies to all other guns and the shotgun 2 upgrade is overridden)

    So my question is: How do I make it so that the correct animation appears with the correct object in situations like this? And, if that's not possible for whatever reason, how would you recommend I go about making multiple upgrades for the same gun part?

CJacobsSA's avatar

CJacobsSA

Member since 26 Sep, 2014

None one is following CJacobsSA yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies