Ready for an intermediate GMS course to grow your skills? Check out my new course: Now we get to drawing! Not sprites or backgrounds, but the text and health bars for the player and enemies. By the end of this section, we’ll be displaying the menu and info for Sara and the Master Ninja. In the next part, we’ll be able to interact with it.
Check out my GameMaker Studio course on Udemy for only $9.99:
Completed Project with comments —–
Connect with us on Twitter @ BeyondUsGames
Support us on Patreon here: patreon.com/BeyondUsGames
Nguồn: https://shaarique.com/
Xem thêm bài viết khác: https://shaarique.com/game/
Adam Christensen
July 9, 2020Hi! First of all I love your videos. It's been really exciting getting to the place that I'm at in the game.
My question is that it seems to be calling the enemy into the battle room because it's drawing the enemy's health bar and his name around a certain spot but the actual sprite isn't there. I'm not getting any fatal errors, it's just not showing the enemy.
Luke Rosettani
July 9, 2020I keep getting told that Variable obj_ninja.<unknown variable>(100011, -2147483648) not set before reading it.
What should I do
Atma505
July 9, 2020I've found that when it comes to positioning objects, using
ww = window_get_width();
wh = window_get_height();
… and then setting the instance's x to, for example, ww * 0.60 is the way to go. Guarantees it'll be on the screen no matter the size, and you don't have to fiddle with setting an exact pixel value.
Chibi1986
July 9, 2020Since I'm not seeing any similar questions, what should I do if my code does not produce the text of the characters or the health/energy bars? The battle_controller is persistent, but my screen resolution is 320×240. (Using MS-DOS resolution for my game.)
The Edgy Penguin
July 9, 2020I keep getting this error:
action number 2
of Draw Event
for object obj_battle_controller:
Unable to find any instance for object index '20'
it say it can't find the index of a sprite I'm using don't really know what that means
Jamie Walsh
July 9, 2020I have a error that states the following:
Variable Test_Character.<unknown variable> not set before reading.
I think it means it is not acknowledging the current and max energy. How do I fix it?
Frank Jeagger
July 9, 2020I recently follow your videos, you are teaching pretty well how to use GM, however, Im getting fatal error when I encountered an enemy, it says Execution Error – Variable Get 2.currentHealth(100009, -1)
at gml_Object_objBattleController_Draw_0 (line 22) – (enemyID.currentHealth/enemyID.maxHealth), c_black, c_red, c_lime, 0, true, true); I checked twice the code, replayed the video and also downloaded your file…but it seems its same error. Pls help x(
Dorl
July 9, 2020I am getting this error ? and all lines I tried is the same error it cant find it ? ( WHEN I DO THE ENEMY PERSISTENT IT IS WORKING BUT ALL ENEMY'S COMING WITH US TOO 😀 )
_________________________________________
############################################################################################
FATAL ERROR in
action number 2
of Draw Event
for object obj_Battle_Controller:
Unable to find any instance for object index '3' name 'obj_enemy'
at gml_Object_obj_Battle_Controller_DrawEvent_2 (line 6) – (enemyid.currentHealth/enemyid.maxHealth) * 100, c_black, c_red, c_lime, 0, true, true);
############################################################################################
O.o O.o
July 9, 2020I keep getting this Error:
############################################################################################
FATAL ERROR in
action number 3
of Draw Event
for object objBattleController:
Variable objBattleController.selectingEnemy(100024, -2147483648) not set before reading it.
at gml_Object_objBattleController_DrawEvent_3 (line 2) – if(inCombat && selectingEnemy)
############################################################################################
I'm not sure on what to do I kept checking spelling. If you can please help me.
Thank you.
Pyxus
July 9, 2020got the following crash error
_________________________________________
############################################################################################
FATAL ERROR in
action number 2
of Draw Event
for object obj_battle_controller:
Variable obj_ninja.<unknown variable>(100011, -2147483648) not set before reading it.
at gml_Object_obj_battle_controller_DrawEvent_2 (line 6) – (enemy_id.current_health/enemy_id.max_health) * 100, c_black, c_red, c_lime, 0, true, true);
############################################################################################
as a heads up I've been using the same variables as you except i've been using snake case since i personally find it easier to rea d. I'm not sure if the error is caused by me accidently copying your camel case variables directly but I have doubled checked and everything seems fine there. Any thoughts on what i might have messed or what I should look for while debugging?
TheHarper
July 9, 2020I am not sure what is causing this error. I have a name for the enemy
_________________________________________
############################################################################################
FATAL ERROR in
action number 2
of Draw Event
for object obj_battlecontroller:
Variable obj_battlecontroller.enemy(100025, -2147483648) not set before reading it.
at gml_Object_obj_battlecontroller_DrawEvent_2 (line 8) – draw_text(enemyid.x – 30, enemy.y + 35, enemyid.name);
############################################################################################
Jesus maldonado
July 9, 2020i have a problem that says
action number 2
of Draw Event
for object objBattlleController:
Variable objBattlleController.enemyId(100026, -2147483648) not set before reading it.
at gml_Object_objBattlleController_DrawEvent_2 (line 5) – draw_healthbar(enemyID.x – 20, enemyId.y – 45, enemyID.x + 20, enemyID.y – 60,
############################################################################################
I havent figured it out yet
Kennet
July 9, 2020Everything works fine to me, just follow the tutorial, recheck all the code.
George Sims
July 9, 2020Having an issue here…
It switched the room and brings in the enemy just fine, but trying to draw the healthbar is giving me an issue
_________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object obj_battle_controller:
Unable to find any instance for object index '4' name 'obj_slime'
at gml_Object_obj_battle_controller_DrawEvent_1 (line 21) – (enemyID.hp/enemyID.max_hp)*100,c_black,c_red,c_lime,0,true,true);
############################################################################################
JurieSempai
July 9, 2020I'm having the same problem as LightningTheif47! I'm using game maker 7.0 and it doesn't recognize that line of code.
for(i=0; i < array_length_1d(battleMenu); ++i)
{
draw_text(200+i + 450, 660, battleMenu[i]);
if(i == battleMenuSelection)
{
draw_line_color(200 * i + 445,680 , 200 * i + 510, 680, c_red , c_red);
}
}
Lightros
July 9, 2020While following along with this video I got the following error after adding the for statement:
In Object obj_battle_controller, in Event DrawEvent action number 1 at line 4 : malformed for statement
This is the line it is referring to : for(i = 0; i < array_length_1d(battleMenu); ++i);
Do you have any suggestions on how to fix this?