psi_paz's Forum Posts

  • A collision is only checked once per pair of instances. It doesn't evaluate both "A collides with B" and "B collides with A" as separate events... they're the same collision. As a result, only one instance ends up being picked, and in your case it may not be the one where EnemyState = ENEMY_STATE_KICKED. It happens in C2 as well... I don't think the dev will fix it though.

    But here's another fix for it apart from overlapping

    As for the 2nd issue... I can't seem to reproduce it

    Oh huh, yeah that did fix it. Thanks for the help. I have a hunch that the 2nd issue might have been correlated with that but I'm not sure. When I got it to happen it was pretty random, with a few exceptions. Sometimes it would fail sometimes it wouldn't. I'll probably have to come back to it at some point but I'll just put it on the list of "things to fix in the future".

  • I trimmed down your project to 15 events and the bug was still happening. For the KoopaHitBox on collision with Enemies I changed it to KoopaHitBox is state 9 and overlapping Enemies and it was fixed. There might be an issue with the on collision event and it being in the same family, which is strange as this method is used to solve collision problems between same object types.

    Bizzare... Yeah I've tried this method for other things too and have never had this problem. I don't know of another (easier) way to do collisions between 2 object types. I have no idea why that specific state screws everything up though. Maybe I'll report this as a bug if it's a C3 bug?? In the meantime should probably try to find another way to have them collide with each other. Have no idea how to go about that, though

  • is Enemies action a plugin ? you might not be picking any specific Enemy in there unless it works like a function with copy picked. For this one you probably have to share the project.

    Custom Actions aren't a plugins they're a built in Construct 3 Feature. They basically work like a function with copy picked like you suggested.

    Sorry for the late reply had to gut the project, this file should have everything relating to the issue. You can observe the glitch within the layout. You can add more or remove the koopas I placed down and compare the first few instances to the rest. I also kept in a Goomba enemy just to showcase how it interacts with other enemies in the same family.

    Link: dropbox.com/scl/fi/088qak5kwnblsr2ht3wap/GuttedKoopaProject.c3p

    I honestly don't mess with For Each that much since I find it usually tanks my performance but that's probably just me (unfortunately) being a spaghetti coder lol

  • This is a two problem issue and both seemingly feed into each other so let me start with the first one. There's 2 parts to this. I have this code set up to where if an Enemy (The Koopa here in this case) comes into contact with another enemy while in the Kicked state, it calls the "genericdeath" custom action. This works *most* of the time. However, when it comes into the first object in the room created, it doesn't do anything. It just sort of phases through it. I tried destroying the first object and noticed that it then starts to fade through the next object that'd be in line after that object is destroyed. I have no idea what to make of this at all.

    Second issue is that sometimes it'll call GenericDeath for multiple enemies at the same time. From my testing, this seems to usually happen if one Enemy is Overlapping another enemy regardless of whether or not they're actually hit by the enemy that should be killing them.

    I've provided all of my koopa code that applies both on the family and individual level. As well I have provided each state variable and the generic death function. Sorry this is a lot of code I know, but I feel like the extra context is needed here. Also all the images are in order descending.

  • Thank you! I tried to modify it a bit to fit my needs more but I couldn't get it down exactly. It also still has that "smooth camera" effect where once stopping the camera lags behind the players position a bit which i don't like. Like once the player stops moving the camera has to take a second to readjust to the players position, which is a small thing but IMO it really affects the game feel. I realize I explained it pretty badly before that's what I meant. Also this is probably my horrible convoluted code but for the life of me I can't find a way to make the transition between the camera switching sides to be less snappy and slower like in the Mario world one. It can get pretty dizzying if you're going left and right a lot. I also made a few changes to the Y scrolling so that way once you pass a certain point on the screen the camera will auto scroll down a bit.

    I really tried my best to understand the expressions here since my comprehension of expressions as a whole is pretty weak. (I have bad dyscalculia) But I think I was able to understand most of it...?

    Anyway I'm pretty happy with how it's coming along so far! I just need help with ironing out these few things... Thank you!

    Here's the capx: dropbox.com/scl/fi/hlzlw456phs3oseemv95m/CameraMario.c3p

  • To be clear I've been at this for about a day and I just am lost about what to do. For context I'm using a seperate Camera object with scrollto on it. Also This is more of a logic question rather than a "can you code this thing for me lol" question.

    I've been trying to make a Mario world styled camera as the title suggestions, but everything I can think of just doesnt work. For context as to how the Mario World camera works: youtube.com/watch . Also a little more context for what I'm trying to achieve - I DONT want a smooth camera. It's true that I want the camera to adjust itself and move according to the player but I want it to be purely linear movement. Smooth cameras tend to have this sort of slow down and speed up effect when stopping or starting that I find to look pretty bad.

    My first idea was to have the camera object be tweened to a "CameraMoveObject" (the solid white lines in the image attached) once the player collides with a "CameraBorderObject" (the dotted lines). First off this didn't really work as expected... YES it did move to the CameraMoveObject but it would only move to one. Okay. Makes sense. So I tried to Pick by UID and then it just stopped moving to the object completely. Then I tried assigning it a variable and it'd only move to that object if it had that variable. Same thing that happened with UID happened here. At this point I just gave up and made them two seperate objects. Okay cool that works now.

    Now a new problem, I have no idea where to go from there. How would I go about setting the Camera to only follow the player when theyre colliding with the camera move object? How do I make the camera still be at an offset when following the player? Better yet how do I even have each CameraMoveObject/CameraBorderObject follow Mario at a certain distance. (I could probably achieve this by setting a layers parallax to 0, 0 come to think of it but that doesnt seem right either...)

    So does anyone know any Construct actions/conditions/behaviors/ect that help develop a system like this? Sorry for being super vague and not really providing code but I really just don't know how to go about this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In my game I have hitboxes and sprites as separate objects. This *was* working fine for a while but recently had an issue with multiple of the sprite objects be affected by one hitbox object. For example if I have something called enemy1 (note that all of these enemies are in a larger Family called Enemies,) if I change its animation after being damaged then some of (not all of them only some) will change to have that animation. I've been passing their (the sprites) UID through a variable assigned to each hitbox. Though I'm not sure if I'm doing it correctly or even if this is the correct way to go about doing things. (See screenshot for more info.)

    My second question would be.. Is it even worth it to separate Hitboxes and sprites for enemies? Like for a player object it makes sense but for something that has more than one instance is it just better to have one enemy object that contains both animations and hitboxes?

    Also I'm willing to share a c3p file later if needed.

  • Yeah, I was just about to come back and say I noticed that lol

    There were a few other issues I had to iron out (enemies would now stop contact with a wall) but in the end it works now. Thank you both for your help, sorry if I was being annoying about it

  • >

    > Will definitely take a closer look later but this probably won't work for me... just because of the way the image points are positioned on the enemy's hitboxes causes them to teleport when mirrored like that. Though they seem to work fine with the normal Mirror behavior so I dunno might be something else

    You didn’t provide any examples, and now you’re saying there are certain points that destroy the whole algorithm.

    It seems like wasting time—giving answers to people who are too lazy to include their own example of the problem in the question and provide a detailed explanation.

    It wasn't laziness I just didn't have time to test much.

    I just did now, however and yes, I was right about it being the image point. If I center the origin point there's no teleporting shenanigans, however if I keep it as is that's when it starts teleporting. And to be clear as it is currently it's at the top left corner of the sprite so it lines up with my tiles.

    When it's flipping the width it's sending it a tile back/forward because... well you know like I said how the image point is placed. I don't want to move the origin point because it'd mess up other code and make me have to redo level layouts. It's a pretty big hassle. Also the enemies stop when colliding with each other currently because of the way I set everything up but this is something I could fix myself since I know what's causing it (I think so at least). I posted my code above if that'd help at all.

    I don't know why mirroring works fine but flipping the width manually doesn't, unless I'm misreading the code, which I probably am.

    Also I'm confused why you thought I didn't include an example of the problem? I did say it was probably the image point earlier. Unless you mean like a video or something but I don't really think that'd help that much.

  • fex.net/s/p2mabem

    Will definitely take a closer look later but this probably won't work for me... just because of the way the image points are positioned on the enemy's hitboxes causes them to teleport when mirrored like that. Though they seem to work fine with the normal Mirror behavior so I dunno might be something else

  • That's basically what I tried to do, no luck. These are the only events in the project that globally affect the Direction the enemies move in. And the Goomba in particular doesn't have any other code that would affect the their direction outside of these events.

  • To be clear the two objects in question here have the platform behavior. Also I should mention this isn't a singular object but rather a family which contains multiple enemies with the platform behavior. What I *want* to happen is for the enemies to collide with each other and then turn around. (So for example if one enemy was moving to the right they'll start moving to the left and vice versa.) A lot of platformers do this but I've been having trouble doing it myself for the past few months. Usually what happens is instead of both of them turning around only 1 will. I've tried putting them into separate Families or just manually doing x enemy on collision with family "Enemies", nothing works.

    Anyone know a better way to achieve this?

  • You do not have permission to view this post

  • Whats the best way to go about doing an animation system? I think everyone knows how to do basic things like walking and jumping ect. however the problem is when you want to do more things with player animations. For example if you wanted to have a player do a short animation when shooting something for grabbing something. You could do this by adding "if animation 'walking' is not playing" then play "animation shooting" and sure that works sometimes and its what ive always done. however when you want to do more complex things this technique can get really messy. you end up having 10 separate events of "if not walking" "if not jumping" ect and its really hard to keep track of everything. and then eventually events start conflicting with each other.

    You'd have to do some sort of state system but I haven't really found a good way to go about it right now especially when a character preforms 2 actions at the same time. And these are pretty small animation changes that only really appear for a few seconds so I'm not sure if a State Machine would even be worth it in this case.

  • I see, thank you both for the replies!