It’s time for me to work on my first boss, and it’s been puzzling me for two days now. I want something pretty simple.
This here is the boss.
Here’s what I’m looking to do: Intro: A wall slides up to block the exit and the boss appears when the player is at a certain distance. I’ll change it to something better when I have the time, I just want to get the actual fight working first. At the beginning of the scene, the boss is set to 0 opacity, so this little scene does work. Phase 1: The boss moves towards the player while playing the idle animation. Phase 2: The boss opens (plays the open animation) and spawns some of my enemies (while playing the attack animation. Then plays the close animation.) Phase 3(if possible): The boss drops to the floor and rolls around left and right for a while. Right now, though, I don’t know if I can do this, so I’m just trying to program the first two phases.
I’ve been trying to program this, but… it’s not working. Previously, I had it go up to the end of Phase 2, but then it got caught in an animation loop. I can’t remember how I had it then, but I tried to fix it and now it doesn’t move past the start of Phase 2, i.e it never opens.
Here’s my code.
The boss has pathfinder behaviour, by the way. All walls are obstacles.
In addition, I have another thing I’d like to do, but it isn’t necessary- I have this boss set to follow my external events for all Enemies, so it shares the same method of killing them- just shoot it as many times as its “health” object variable demands. But I’d like to be able to make it so that you can only shoot it when it’s playing the “open”, “attack” or “close” animations, as if the outside is too thick to shoot through. Is that possible or do I have to remove it from the enemy group to do so?
I wanted it to change between phases until you defeat it, so it goes from 1, then to 2, then restarts.
MoveTimer is just for the boss, it’s paused at the start of the scene. I can’t really show you the whole scene because I have it split up into a lot of external events and then linked together, but it all works perfectly. It’s just the boss.
I tested it some more and the issue seems to be that it gets stuck when it tries to move to it’s position in Phase 2. Once it gets there, it just stops working and vibrates. I tried it with both pathfinding and normal forces, and both make it get stuck once it reaches 3386;290.
I won’t promise that this suggestion will solve the problem, but sometimes when you have a lot of conditions to meet, it can help to group them into the “and” or “or” condition to trigger the actions.
For example…under Phase 2 - Spawn:
Conditions & if all of these conditions are true…
The X position of masterdrone is = 3386
The Y position of masterdrone is = 290
Set animation of masterdrone to “open”
Omit those variable lines on that part because you’re already calling them in the parent events before it for the move action. I hope that makes sense. I just made a screenshot of that code…the blue is what I’d include in the “And” condition (except “trigger once”, that can go under it). The red is what I’d delete as it’s duplicating the code I’m pointing at with the arrow. Let me know if you have questions about my markings on it…
Child 1 - name it “phase_one”
Child 2 - name it “phase_two”
Child 3 - name it “phase_three”
Leave the child values empty and then when you want to activate it, set the value to = 1.
I’ve had similar issues whenever the value is supposed to represent ‘true/false’. Like, I can’t do = 2, 3, etc. for some reason, only when I’m + or - such as for health or inventories.
Also, you may want to try making this a scene variable, instead of an object variable if you haven’t already because once the boss is destroyed, his variables will be deleted from memory. Same thing with the timers
Like…this? (I know that should say =1, I forgot to change it)
I’ll wait for advice before I replace everything, just in case I further ruin things, lol…— I’ll figure out the destroyed thing later. I haven’t actually coded any “transition” scenes yet, so none of my levels have actual endings for now. That’s something else entirely, though, so don’t worry about it. (I’ll do all the worrying… )
As for Xisco, I’m a little hesitant to share any files, I don’t know why. I’ll do it if it becomes necessary, but it freaks me out when people look at something I’m making, I really don’t know why…it’s like when you’re drawing and someone is watching you. But this is such a great community, everyone is really nice and friendly, so I’m sure I’ll overcome this in time!!
I greatly appreciate you both for trying to help me. You guys are so fab!
In events, omit the variable “Attack” since that’s now a structure and keep “Attack.phase_two”.
If you’re afraid of ruining the code you have, you can always disable that part for the time being and add the changes separately - copy and paste what’s useful into the new stuff. When the new stuff works as you want and you’re ready to clean up the sheet, delete the disabled events
You’re welcome and good luck
And I totally understand where you’re coming from with sharing files. I don’t like to do that either. Even if the art isn’t great and the code has mistakes, no one should be just taking someone’s assets and code without asking or giving credit for the time spent on them (that can be just as valuable to the person spending it even if the fruits of their labors aren’t worth much). WIP’s are just inherently messy though and sometimes embarrassing lol.
This is how it’s looking so far, and it still isn’t working =,=’’
I wish there was an easier way of giving objects “phases”.
The problem now is that it still gets stuck and does nothing when it’s time to switch to the “attack” animation, it just stays in that spot and does nothing. However, this time, it doesn’t play the “open” animation either…
I’m so, so sorry for bugging you with this now, it feels very awkward for me. It’s just not working! And this is the simplest boss of the game, if I’m having so much trouble with this one, then the idea of making complex ones is beginning to scare me a lot.
You’ll get it working and I don’t mind helping (or trying), although I may have to continue later as I have some offline errands. Anyway, you’re not bugging me.
Sometimes it helps to walk away for a bit, get some rest (if not sleep, then just rest your eyes from the screen), grab a meal, and come back at it refreshed and don’t be afraid to keep experimenting.
Try moving your timers so that they’re not sub-events and again, make them scene timers as they’re still object timers. Also, I think you’re missing the timer reset actions. Add them wherever you specify “MoveTimer is greater than __” and then maybe in the beginning do:
Thank you, I’ll try my best. And good luck with your errands.
edit: After messing around for a while, I’m going to try a new strategy. I realised that your timers work perfectly, but it really is just that one moment where it’s meant to switch animations that doesn’t work- because if I set it to just repeat Phase 1, it does.
I…also drew a new background for the room. And gave him an intro cutscene. I’m going to see if setting a point on the background and having him move there instead of an X/Y position in the room will help.
But first, I’m going to eat some pasta, lol.
Edit 2: Hmmm…Well, it seems to work better than the other way, but it still gets stuck. I think it’s getting confused and tries to do both “open” and “attack” parts at once,?
I’m not sure how much your events have changed since the last post, but going by them, it looks like the “open” animation isn’t stopped before starting “attack” in the sub-events.
I made a test project to see if I could get the animation part working. It’s all very very plain and simplified. There’s stuff that you won’t need in the code - at least not for your boss battle - but maybe there are some useful bits. Feel free to take what you need and discard the rest.
The graphics are quick and ugly little things that I made just to see the code in action, nothing spectacular lol.
well you people is who asks for help. This is not a programming language. in gdevelop if whe can’t see the events order is hard to know what are you doing wrong.
Me and others give or time and knowledge for free, so it is not much to ask to make us easy to help.
I know…I’m very sorry. I know it’s annoying. I’d just prefer to show screenshots for now.
ANYWAY…I FINALLY FIXED THIS FIGHT.
Somehow, in the process, I’ve eradicated part of the cutscene, but I’ll fix that, it’s nothing.
It turns out, that the major issue was it was trying to run two events at the same time- everytime it tried to close, it skipped ahead to phase 1. And when it got there, the MoveTimer was already a high number, so it switched to phase 2 instantly- which means it was just an endless loop of the “attack” animation to the “open” animation.
I sorted everything out now. I truly appreciate the help, and I’m sorry for making it harder than it needs to be. This community is amazing, and I hope I’ll become a better member of it for you in return.
Here’s some video footage. And yeah, the graphics and sound effects are almost all placeholders for now.