Ranch Dubois's Forum Posts

  • Not at all, it was a demonstration for you to learn from and use however you like. If you look at the layers window in the editor you will notice that there are two layers. Layer 0 is the layer that most of the stuff is on and layer 1 is the layer where the blockers live. With that layer selected, up in the properties section you will see that parallax X&Y are both set to 0. This means that anything on this layer will remain where it is regardless of if scrolling is happening. Parallax at 0 is used a lot for UI elements etc.

    When setting up objects on a 0 parallax layer you have to remember that they are relative to the viewport, not layout. So in the editor make sure you set them to the correct position on the viewport, or position them accordingly using events at runtime.

    Thanks so much! This is super useful information for the future. However, I've got another problem now. When I was only using two player bases I thought it had something to do with their x-positions overlapping, but when I added the remaining two-player bases I realized that the way the camera seems to figure position as it relates to the viewport causes it to wig out when the player closest to the edge is airborne. I really have no clue why having a different y-position would mess with finding the x-position closest to the viewport and since the players in your sample only moved with respect to the x-axis, this problem did not pop up in your project.

    I tried to record a video replicating all of the weird bugs I had encountered: youtu.be/OqVXGO9A7Ks

    It's a few minutes long because I tried to get as many different iterations of the bugs as I could replicate, but to specify here are some of the common bugs related to this y-position viewport problem.

    - With one base positioned at the right end of the screen, another in the mid-right, and two more on the left end, if the base on the right end jumps and holds out into the edge barrier, they'll warp through it, resulting in the camera snapping to its new position and either dragging all of the player bases with it or leaving the two leftmost ones outside of the barriers and out of the viewport entirely.

    - If one base jumps over another so that at around the apex of the jump the two bases x-positions are overlapping the camera won't follow the jumping base. When the jumping base hits the ground, the camera snaps to a new position to accommodate it, as if the camera doesn't detect the jumping base when it's airborne.

    - These problems seem to common less common and less obvious if I shorthop instead of holding jump for maximum jump height, but that may just be because the base is airborne for a shorter amount of time.

    - Being on the top or bottom platform seems to influence whether or not a player base can push the viewport by holding into its respective edge barrier. The details of this bug are tough for me to articulate since it's a bit hard to tell what's going on, but I tried to get a couple of instances of it in the video.

    If you know anything about why changes in y-position would be messing with how the program detects x-position with respect to the edge of the viewport and how I might be able to go about fixing it, please let me know. I'm fresh out of ideas and this is a bug I would like to fix before I try to program something more complicated like health/damage and hitboxes/hurtboxes. If you want to see what kind of code I'm using for jumping or running, give me a shout and I'll put it here. Again, thanks for all the help so far.

  • A camera to follow a player smoothly for a side-scrolling platformer can be done in one event using:

    Set Scroll X - lerp(scrollX,playerobject.X,0.2) This will give you a smooth horizontal scroll using linear interpolation. You can adjust the speed by tweaking the 3rd number to a value between 0 and 1.

    For more than one player I have attached an example that, as you mentioned, finds the midpoint between the first and last player and then applies the same logic as the single player scroll. There are blocking objects placed at the left and right edges of the viewport to prevent a player from disappearing off-screen.

    The method also encourages moving right as the farthest right player will move the camera up until the point that the farthest left player is touching the screen edge. If the farthest left player then moves right, the camera will continue to move forward until it reaches its intended position.

    I have included a method for using families (if you have a license) and for not using families.

    Let me know if you have any questions :)

    https://1drv.ms/u/s!AkmrWgxeuxlKhIc3pPm0W1AeqXZWZA?e=5gMcpt

    Thank you so much. This is exactly what I needed and I learned a lot in implementing it into my own project; I hope you don’t mind that I copied it.

    The only thing is I can’t figure out how to get the screen edge blockers to move with the viewport. I didn’t code anything in that would make them follow, but I also couldn’t locate anything in your project that would cause them to move. What did I miss that causes the blockers to move with the camera?

  • So I tricked myself into thinking that programming in Construct was way easier than it was. I thought after watching a bunch of videos and reading a bunch of tutorials that I'd be pretty set to go, but I'm still feeling pretty overwhelmed. What I'm trying to do right now is make a camera that follows the player so I'm trying to take the one from the KiwiStory sample game. It looks to me like I have all the stuff KiwiStory has, I've made all the variables and checked all the instances and the camera still will not follow the player. I tried to record a quick but comprehensive showing the problem:

    youtu.be/ONZpjCk7X9c

    This is meant to be a four-player game with each player being a different colored knight (red, blue, yellow, green) so I need to find a way to somehow make it so the camera is constantly accommodating all four entities without zooming out while also encouraging moving to the right. I'm guessing this would involve somehow making the camera's position some kind of average of each players' position and/or making the outside of the camera into collisions somehow to prevent players from wandering too far ahead or behind. This is totally an issue for me to solve another day (I don't even have a working camera or multiple players to begin with) but I thought it was something related so if anyone has any ideas or input that would help me future-proof this camera to accommodate four players that'd be great.

    Thanks in advance for the help. If anything is unclear or needs further clarification I'd be more than happy to respond.

  • I tried to hold off on changing the knight's image point because he moves around so much, so I just messed with the center of the base and now it looks like the knight is standing, running, jumping, and falling normally on solid ground. Thanks a million!

  • Turns out that was the problem. Thank you! My logic for pinning the two together is just "System -> Every Tick -> Player (the collision-less animations) -> Set Position to Base.X, Base.Y"

    So I guess off the top of my head there are two ways to fix it. I'm assuming one is changing the last step to "Base.X-??, Base.Y-??" and just jimmy it until it looks right. The second would be to ditch the mask-base separation and give the player sprite all the collisions. However, something I plan to attempt to implement pretty soon is combat and the player's disjointed hitboxes. Since he's got a flag to attack, his flag swing should not occupy the same area as his body, so I was told I would need the mask-base separation to make two separate collision polygons, one for terrain collision/hurtboxes and the other for hitboxes. Is this true or do you know if there is an easier way to create a hitboxes-hurtboxes separation that would allow me to ditch the mask-base separation, provided ditching the mask-base is the best option?

  • My "Base" for the player's collision and the pink collisions both have collision polygons that occupy the entirety of the sprite. I thought the collision of the "Mask" (the red knight) might be the issue but he has no collisions and exists purely to represent the position and motion of the player, as of now. Maybe it's something to do with how I stretched one of the collisions, but I've tried messing with it and the results seem to be the same. I'm thinking it's got to be something to do with the collision polygons that I don't know about.

  • So I decided to start digging into the actual game-building part of a project I have been working on for a long time. After reading a bunch of tutorials and watching a bunch of videos, I thought I would be able to jump right in and get some decent work done. Turns out that's not the case and I'm feeling pretty overwhelmed. Most urgent problem is that my collisions seem to be under where the actual pink sprite appears on the screen and my camera is inoperable. Is this a common or easily fixed issue?

    youtu.be/rIJLgR79jtI

  • I believe he meant create multiple sprites (boxes) with their own collisions pinned to the character. Enabling/disabling when needed.

    Ohhh I see. Thank you!

  • The most straight forward approach to this is to create multiple collision boxes for the same character and pin them to his fists and legs, disable their collision check and only reactivate on specific a frames when the animation indicates that the character should inflict damage to the enemy. You don't need to eliminate them everytime you need to do damage check, just disable the collision of these boxes.

    So I guess there is a way to create more than one collision polygon. I will have to look at this. Thank you!

  • As I make the attack animations for my teamwork-based 2D playformer, I realize that I never tried to creating a separation between hitboxes and hurtboxes in Construct 3.

    What I’m trying to create is, for example, if you were playing Smash Bros. and it was Link vs Ryu or smth. They’re both on the ground and try to lunge out to hit the other, Ryu with his leg and Link with his sword. Ryu’s leg and Link’s sword collide. Ryu takes damage because his leg was hit by the sword, but Link takes no damage because even though Ryu’s leg hit his sword, the sword is not a part of Link’s body. In other words, because Link has a sword, his hitboxes extend further than his hurtbox does; his hitboxes are disjointed. Since Ryu does a lot of fighting with his fists and legs, his hitboxes don’t really extend past his hurtboxes as much.

    My player-controlled characters use weapons that extend past their body as Link’s sword would. My first idea was to create two separate collision polygons on the player character’s animations, but unless I’ve missed something I don’t believe there’s a way to assign two totally separate collision polygons to one animation frame. My second idea was to make the player characters into two separate entities, much like the Kiwi player character and its “base” and “mask” in the Kiwi Story sample game. The problem with this is, the way I see it, I would need to give every instance of a recurring enemy character with disjointed hitboxes so that I would have to say “thisenemy1’s base is attached to thisenemy1’s mask... thisenemy2’s base is attached to thisenemy2’s mask...” even though both “thisenemy”-s would be visually and functionally identical.

    If my second idea was indeed the best way to create hitboxes vs hurtboxes and there actually is a way to give recurring enemies disjoints without making a brand new entity every time, please tell me how I can do that. However, if there is a better/more intuitive way to create this hitbox-hurtbox separation, I would greatly appreciate if someone could tell me how or direct me to a video that explains it. Thank you in advance for your help!

  • Yes they should be the same size

    So just to check if I understand, for most every moving sprite I make, I should make the canvas larger than I need to for the first animation and also I should have a center point on each entity’s canvas where I always draw the center of the character’s body?

  • I asked an extremely similar question very recently and made some decent headway, but I'm still having trouble with the character's body moving and shrinking when I change the size of my sprite animation. Is there some way to set a focal point or some kind of boundary on each animation, or should every entity's individual animations be the same size?

    Subscribe to Construct videos now

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why not just try it and see what happens? Construct should automatically adapt the object size to a newly imported image size.

    So, I quickly created a little rectangle player object and gave it a 16x16 pixel idle animation (hardly an animation; it’s just a single frame).

    Then, I attempted 32x32 pixel 7-frame animation of the rectangle character doing a Fatal Fury-style “Power Geyser” where he sends out a flame pillar in front of himself. The body of the rectangle character itself shrank, I suppose because I changed the canvas to 32x32, and it also moves forward, supposedly because in the idle frame he was the center of the animation but in the “Power Geyser” animation the rectangle had to share the space with the flame pillar. Is there some kind of work-around or remedy to this shifting and shrinking?

    Subscribe to Construct videos now
  • Why not just try it and see what happens? Construct should automatically adapt the object size to a newly imported image size.

    Thanks. Will do. I just wanted to know if there were any precautions I should take once I start making these different-sized sprites. The one I had animated before I lost my progress because I got a new computer was a simple walk cycle, which stayed at a constant canvas size when I drew it out.

    That being said, what exactly do you mean by adapting the object size? Can you somehow have it recognize the sprite's "body"? Or is it more like for each individual frame for each individual animation for each entity I can set some kind of center point?

  • I’m having to start over from scratch because I forgot to save my single sprite animation from when I started and then I got a new computer, but before I resumed this project I wanted to ask a question:

    Say I’ve got this sprite of the player’s character (2D platformer) and I made him on a 10x20 pixel canvas, for the sake of this hypothical.

    I want to have some form of “power-up” so say one of these power-ups is the character takes out a huge weapon, holds it behind him, then swings it overhead, and then it lands in front of him. I make this animation on a 50x50 pixel canvas.

    If I save all of these pngs and give them to Construct 3 as they are, will my player character be shifting and shrinking as he starts this weapon swing? If so, should I just do everything on the same size canvas?

    Thank you in advance to anyone who tries to help. I hope my description of the situation was adequate.

    Tagged: