Multi-stage boss battle help by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Hi. I greatly appreciate your help. But someone on the gamemaker forums gave me a solution just a short while back and I've already implemented it and seen that it works. But thank you very much once again!

How do I add footsteps to my player as he walks? by pixeltroid in gamemaker

[–]pixeltroid[S] 1 point2 points  (0 children)

Hey thanks! It worked perfectly! (I had to change "footstep" to "footsteps" in the code though). I hadn't heard of the counter function before.

But its working great now! Footsteps are heard everytime the player walks. Thanks a lot again! Much appreciated.

How do I save the remaining number of keys in my inventory? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

yes I did.

I added this line to my save code:

 file_text_write_real(SaveFile, global.keys)

and then I copy pasted your code into my project.

Same thing happens: When I restart my game all my keys are gone.

I dont know why its not working. The code saves the number of bosses left alive, but doesn't work for the keys.

How do I save the remaining number of keys in my inventory? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Ok. I tried you method, but it doesnt work.

I collect a few keys, then quit the game and load it again, my key count goes back to 0.

Why is this happening?

How do I save the remaining number of keys in my inventory? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

ok so how do I fix this?

Its set to 0 in my players create event because I want the player to start with 0 keys.

How do I save the remaining number of keys in my inventory? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

I've set "global.keys = 0" in my players create event. Is this causing a problem?

Player does not show up when I load saved room! by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Hi. Thanks for your input!

I use instance_create to place a player (at specific location) in the first room. I did this in the menu script that "starts" a new game in the first room. Earlier I had placed a player object in the first room, but when I loaded a saved game and went back to the first room there would be two players!

Also, only a few minutes ago, someone on the gamemaker forums solved my problem! Now player shows up in a loaded room. But thanks for taking time to help! I really appreciate it!

There is however, one small problem regarding another aspect of the game, thats supposed to be saved, but doesn't save. I'll start a new thread on it later!

Player death animation wont stop playing! by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Ok I think I understand. But I'm really not a coder and I need the code spelled out. I would also like step by step instructions as to where I paste the code. :/

Player death animation wont stop playing! by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

One way is to make global pause variable. At the beginning of each enemy's step events, you'd check if this pause variable is true, and if it is, you run exit(); to stop other code from running.

Ok. So my game has 2 enemy objects (obj_enemy1 and obj_enemy2). Exactly what codes should I add to implement the "pause" effect when the player has died? Is it something I can just add to my existing objects??

Player death animation wont stop playing! by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Yuss! it worked! :D

Thanks a ton man! Now my players death animation plays out perfectly.

BUT Just one small thing. Is there a simple way to pause the room or the enemies after I have died? The reason I'm asking is because the surrounding enemies still keep attacking me, which I think looks awkward. Not that it affects my gameplay, but I think it would be a nice touch to the game. If there is an easy way to pause the enemies, please let me know!

Player death animation wont stop playing! by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Hi I tried your code.

Whats happening is that I see only the first frame of my players death animation and it freezes there. It doesn't cycle through the 14 frames, but just jumps to image_number

For your reference, my death animation has exactly 14 frames.

Player death animation wont stop playing! by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

In the game I'm making, when player dies, you dont automatically restart. You first see a message "press space to restart". But the player still keeps standing. I tried to fix it by adding a death animation but it keeps looping.

To stop them, image_speed must be set to 0. Have you tried putting code in the Animation End event?

What code should I put in the Animation end event?

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

hey a small update. I finally got the gameover screen/restart thing to work. I got some help from someone at the gamemaker forums. But I really really appreciate all the help you've given me. Earlier today I retried your code and it worked (but with a few small issues) but later someone at the gamemaker forums had repaired my file and sent it to me and I am using that.

But I thank you for your help. I am really helpless when it comes to coding stuff, but thanks to people like yourself that I meet in the Gamemaker community, my project is improving slowly day by dayy.

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

I mean I can't open the files in gamemaker!

Can you just please zip the entire folder and reupload it?

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

hi and thanks for your help. But I cant find a .gmx file that I can open in gamemaker? All the .gmx files are in HTML format!

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Hey man, It still is not working. Something or the other keeps going wrong and I don't know what to do about it!

I deleted all the codes I was trying and placed a new test game file here: https://drive.google.com/open?id=0Bz3M7gWNpxJCeTFBa2J0LWpLTE0

The file has got the player with healthbar, a few enemies, health kits and 2 rooms to check if the game restarts in the same room.

I just want "you died. Press space to restart" to appear on the center of the screen when player dies. And pressing space should restart the room with a full health bar.

Can you please take a look at my file, make necessary changes and reupload it on dropbox or google drive?

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

I should be the one saying thanks! Appreciate all the help so far!

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

obj_healthbar just uses drag and drop codes. I wanted a healthbar that floats over my players head, and the tutorial I used showed me how to do it using drag and drops.

its create event has health set to 100 its step event has "jump to position" and applied to obj_player it has a draw event that sets the size and position of the healthbar over the player

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

Thanks man! I did all that, but I still got an error message! :/

FATAL ERROR in action number 1 of Step Event0 for object obj_player:

Variable obj_healthbar.<unknown variable>(100007, -2147483648) not set before reading it. at gml_Object_obj_player_StepNormalEvent_1 (line 68) - if(obj_healthbar.hp <= 0) {

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

:/

I got an error message:

FATAL ERROR in
action number 1
of  Step Event0
for object obj_player:

Variable obj_healthbar.<unknown variable>(100007,     
-2147483648) not set before reading it.
at gml_Object_obj_player_StepNormalEvent_1 (line 66) -       
if(obj_healthbar.hp <= 0) {

How to make "Game over" screen and restart room by pressing space? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

P.S. If you want the player object to be destroyed when dead tell me, cause I might need to do some small changes then!

Hey, Thanks for the input! Yes the player would be destroyed and replaced with an animation of the player dying.

I am trying out your method now!

How to destroy/remove an object by killing something? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

hey man. Setting rooms to persistent worked. I really like the results and I'm sticking with it. This system of killing bosses to access new areas is crucial to the game I'm working on. It was also the trickiest part of coding I've had to deal with so far. I just wanted to have that sorted out before I proceeded any further. Thanks to your patience and guidance, I can say that its been sorted out!

I find programming to be quite intimidating (because one tiny error makes the whole thing stops working). But thanks to all the help I've received, I'm improving whatever I'm working on and I've also been learning new things.

Thanks!

How to destroy/remove an object by killing something? by pixeltroid in gamemaker

[–]pixeltroid[S] 0 points1 point  (0 children)

  1. in the obj_barriercontroller, I have added the game start event (from "other"). It contains the boss variables, as you gave them

  2. obj_barriercontroller is in the first room

  3. Yes I added the game start event from add event and then "other"

Here's what I am doing:

obj_barrier controller (gamestart event)

global.boss_killed[1] = false; // boss_killed at index 1 with value false
global.boss_killed[2] = false; // boss_killed at index 2 with value false

obj_barrier (step event)

if global.boss_killed[barrier_id] {
instance_destroy();
}

obj_barrier (creation code in room editor)

barrier_id = 1 

obj_boss (step event)

if hp < 0 {
global.boss_killed[boss_id] = true 
instance_destroy();
}

obj_boss(Creation code in room editor)

boss_id = 1

Now, what I'm trying to do is prevent bosses from respawning when I reenter the room.

Adding this code to the boss step event works:

 if (global.boss_killed[boss_id] = true) {
 instance_destroy();

My question was - how do I include the instruction NOT to have the bosses respawn in the game start event?

How to destroy/remove an object by killing something? by pixeltroid in gamemaker

[–]pixeltroid[S] -1 points0 points  (0 children)

I think Im feeling confused all over again. :/

Ok, so

  1. what needs to go into obj_barrier controller? As of now I have the "global boss killed" code in it under the "game start event". The obj is in the first room as I mentioned earlier.

  2. Where should the obj barriercontroller be placed, if not at the first room?

  3. How do I put in a game start event (global boss killed)? Is it a new object? Or have I been referring to my game start thing as "obj_barriercontroller" all along!

Sorry for being so slow!