YoHoho's Forum Posts

  • .....

  • > FYI in Construct 3 you can create an object by a string of its name, which may be what you need.

    stop self-advertising pls and give proper help.

    ps. maybe im totally wrong here aswell

    ....

  • YoHoho I made a quick demo - roughly based on other path following samples made by ROJOhound years ago :)

    you can add as many nodes as you want - the only catch is you have to set the NodeNumber instance variable consecutively. if you have nodes 1,2,3,4,5,8 it will stop at node 5 because it wont find a node 6.

    you can arrange the nodes any way you want - it will move from one to the next (either up or down depending on the direction).

    https://www.rieperts.com/games/forum/follownodepath.capx

    Now this totally works the way I want it! Clearly I never would have figured any of this out on my own. Thanks again to all 3 of you for making an effort to create this.

  • The upside down T sounded interesting, which is basically a path that has branches. Here's what I came up with. Defining the paths is pretty tedious since you have to place a list of the uids of all the connected nodes in each node, but the events are fairly simple albeit dense.

    https://www.dropbox.com/s/maef5spnv5olc07/path_follow_2.capx?dl=1

    The motion is driven by the the input angle. If the object is between nodes the object will move forward or backwards depending if the input direction is pointing more in one way or another. Also when a node is hit it will look at all the connecting nodes and pick the one with the lowest anglediff with the input angle to move towards.

    The events a mostly easy enough to follow I think. The exception is probably the formula in event 13:

    obj: add (cos(inputDir-self.ang)>0?1:-1)*speed*dt to d

    inputDir is the angle from the keyboard input

    self.ang is the angle between the current pair of nodes.

    cos(inputDir-self.ang) is the dot product between two unit vectors made from those angles. It just simplifies to that. If the dot product is positive then the inputDir is mostly in the same direction as the angle between the nodes. And if it's negative then it should go backwards.

    The conditional ...cos(inputDir-self.ang)>0?1:-1 is to make it only positive or negative 1. That is to keep the speed constant.

    The remainder is to apply the speed in that direction with dt.

    Holy Crap. This works like a dream. I wouldn't even begin to understand anything involving all that Construct math. I was able to adjust the speed of the object so that's a plus.

    How exactly would you be able to add more nodes? I couldn't figure out your number setup for the 'wide U shape' nodes. The setup for the 'wide U shape' seems to be the better one since it has the most nodes for the object to search for. I was even able to shape it like an 'upside down T' as well and have it so that the object moves all the way to the right with just pressing right on the keyboard (pressing left led to the object getting stuck until I pressed up).

    In my game, the player only has to press Left/Right and the sprite would move to the far end of the set path. If you can show how to add more nodes properly then you could make a path that goes just about anywhere in the layout in any shape.

    Thanks alot to the both of you.

  • If you open Rex's demo project and add this code, you can make the sprite to move in reverse at any time:

    You can use this method to change direction. If you need, you can also slow the sprite down by decreasing speed. Say, if the sprite is moving to the right and player is holding Left key, decrease speed until it falls to 0. Then change direction and start increasing speed.

    Well, this turned out to be interesting.

    I added the code to one of the spline demos I have and it sometimes works. Then there's the whole issue of the object being generated by clicking START and then sometimes gets stuck on the waypoints. The reversing of direction sometimes works.

    This just isn't going to work for a player controlled object IMO. But I can use this for some bizarre enemy movements. Maybe what I need is to have the player stuck on a 'conveyor belt' type path that can have angles in it and move the player left/right that way.

  • There are two addons you can try:

    https://www.construct.net/en/forum/extending-construct-2/work-in-progress-addons-30/behavior-rexspline-114539

    https://www.construct.net/en/forum/extending-construct-2/addons-29/behavior-splinepath-45373 (there is a working donwload link in comments)

    I actually was thinking of these, but I want to able to control the movement of the sprite manually. Essentially I want the player to move their character to the Left/Right of the screen to catch an object along a 'rail' like path. It's like how in the old game Warlords you can move your character in only an arc (which is the 'U' shape path I mentioned).

    The spline path thing, however, is just great for moving enemies around and I can't wait to implement it in something.

  • I'm still looking to get some insight into how to create this limited movement for the player. Any help would be appreciated.

  • I'm looking to create a game where the player moves the character along a restricted path on the game screen. The player can either SWIPE for quickest movement or hold Left/Right on the screen to move that direction, going in either direction to dodge and attack.

    The paths I'm thinking of are: short wide 'U' shape, short wide 'V' shape, a horizontal line and an upside down short wide 'T' shape (which would be one long path that goes from Left to Up to Down to Right. I can see creating some invisible solids that restrict movement of a sprite but I'm sure there's a better way.

    Any help would be appreciated.

  • Pin two helper objects on either side of your camera object at the left and right edges of your viewport. Where your camera goes, these boundary objects will go too, and make them solid so your player can't go through them.

    OK, I was able to get this working properly. My concern was having things not move at the right pace but it's fine for the game right now. Thanks a lot for the idea.

  • There are two main ways to set up this sort of game, and the answer kind of depends on which method you use.

    a. Is the entire level created ahead of time and you're actively scrolling and moving through it? There are a few ways you can keep the UI in place, including the viewport expressions, anchor behavior, and layer parallax. Using the same idea of holding your UI in place, you can also place invisible helper sprites that define the edges of your screen. Those would be solid to prevent your character from moving through them, or maybe push out solids using custom movement with the character having the solid behavior.

    b. Does the character and viewport actually stay still and the objects/stage generated off the edge of the viewport and move past the character? See the space shooter template for this type of setup, I'd recommend this if you're trying to emulate Balloon Trip.

    It's definitely method A that I'm going for. I have it setup so that when the player presses a key, the camera object scrolls to the left and the player can't go past the viewing window while dodging obstacles in the game world.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm working on a game idea that involves the screen scrolling from right (beginning of the level) to the left. This is similar to how the Balloon Trip mode works in Balloon Fight for NES.

    I'm not sure how to accomplish 2 things in particular:

    1) Keep the player from going out of camera view on the extreme left or right of the game viewing screen

    2) Having a GUI on the screen that doesn't move while the game goes from right to left; I have no problem with this having the screen go from left to right

    Other game mechanics seem fine. Any help would be appreciated.

  • Percentage of the hp to apply to any hp amount would be like :

    25% = maxhp*0.25

    50% = maxhp*0.5

    75% = maxhp*0.75

    To set animations based on this they would probably be a variable and you check between the values.

    So for first animation Is between 75% and 100% = is between maxhp*0.75 and maxhp

    second anim = is between maxhp*0.5 and maxhp*0.75

    third anim = is between maxhp*0.25 and maxhp*0.5

    final anim = less than max hp*0.25

    And so you don't have to keep writing formulas you can assign them variables :

    var1 = maxhp*0.25

    var2= maxhp*0.5 etc

    OK, so I would have to create a variable of what the max HP of the object is first, then I can perform the calculation afterwards for the animation events. I'll give it a shot.

  • This is something that I haven't figured out how to do properly in years and I would like to apply it to multiple projects I'm working on.

    I have an object that has HP. When its HP is lowered, I want the object to show cracks in it. The animation is simple but I don't understand how to calculate the damage percentage wise.

    What are the proper values to have an object show a certain cracked animation frame at 75%, 50% and 25%? And how would I adjust this to work with even more animation frames in the future?

    Any help would be appreciated.

  • Sprite is on-screen (inverted), trigger once > create indicator object at edge of screen.

    Sprite is on-screen (inverted), indicator object set angle toward sprite.x,sprite.y

    Can you create a simple example of this? I'm looking to have something like this for one of my games but I'm not sure what you mean by putting 'on screen (inverted)'.

  • Check out the free RPG with Construct to get an idea : construct.net/en/blogs/construct-official-blog-1/demonoire-new-bundled-rpg-for-construct-3-949

    Yeah, I had checked that out before. I'm not a C3 user yet but it is interesting. That game is more along the lines of Legend of Zelda, though. I'm really talking about something akin to Final Fantasy, Dragon Quest, etc. Those games are far more complex and random and that's what I'm looking into.