Page 1 of 1
GMK Help?
Posted: Mon May 16, 2011 7:59 am
by md
I'm making a game, and for some reason, the boss is invisible?
I've done all it's events and it still shoots out it's bullets and moves how it's supposed to, but it's invisible.
- -Visible is ticked.
-When I put it in a different room (even the main menu), it's invisible.
-All it's "Step" event has is a code saying if it looses all it's health, it gets destroyed. Here's my code:
Code: Select all
{
if (obj_boss1.HP<1)
{
instance_destroy()
};
}
Does anyone know why?
Thanks!!!

Posted: Mon May 16, 2011 10:45 am
by MyNameIsKooky
Do you have a draw event? Draw events always elimate the default sprite for the object and replace it with whatever is drawn.
Aside from that, I can't really see the source of your problem unless you give all of the object properties for the boss.
Posted: Mon May 16, 2011 8:55 pm
by boywhoflies
If it's not the draw like Kooky said, Game Maker is a noob again. Cut all your code and paste it in the same place, I guess. That somethimes works for me.
Or you put in a diffrent object with the same sprite by mistake?
Posted: Tue May 17, 2011 5:53 am
by md
MyNameIsKooky wrote:Do you have a draw event? Draw events always elimate the default sprite for the object and replace it with whatever is drawn.
Aside from that, I can't really see the source of your problem unless you give all of the object properties for the boss.
I do have a draw event, all it has is a code that draws the enemies health bar.
Code: Select all
//Draw the enemy's health bar.
{
draw_healthbar
(
220,
view_yview+35,
420,
view_yview+55,
HP,
noone,
c_fuchsia,
c_fuchsia,
0,
0,
1
);
}
Do you see any errors. Thanks!

Posted: Tue May 17, 2011 5:58 am
by md
md wrote:MyNameIsKooky wrote:Do you have a draw event? Draw events always elimate the default sprite for the object and replace it with whatever is drawn.
Aside from that, I can't really see the source of your problem unless you give all of the object properties for the boss.
I do have a draw event, all it has is a code that draws the enemies health bar.
Code: Select all
//Draw the enemy's health bar.
{
draw_healthbar
(
220,
view_yview+35,
420,
view_yview+55,
HP,
noone,
c_fuchsia,
c_fuchsia,
0,
0,
1
);
}
Do you see any errors. Thanks!

Oops, there's a little more in my "Draw" event. These are my actions:
- "Set the Colour"
"Set the Font"
"Draw a Rectangle"
"Draw a Text"
That's all I have in my draw event.
Posted: Tue May 17, 2011 10:11 am
by md
MyNameIsKooky wrote:Do you have a draw event? Draw events always elimate the default sprite for the object and replace it with whatever is drawn.
Aside from that, I can't really see the source of your problem unless you give all of the object properties for the boss.
You were right. It was the draw event. I tried putting it with a different object and it works!
Thanks!!!

Posted: Tue May 17, 2011 8:34 pm
by boywhoflies
I see what happened.
You drew the healthbar, which disabled the sprite. In those cases, I use this code:
Code: Select all
draw_sprite(sprite_index,image_index,x,y)
. That draws the sprite normaly(same possion and all that. Don't change any of it...). The only problem is that image_angle dosen't work with it.
I'm just putting this down for other times, I know you solved it.

Posted: Wed May 18, 2011 12:36 pm
by Blast!10
boywhoflies wrote:The only problem is that image_angle dosen't work with it
Easy to solve if you have the Standard/Pro edition:
Code: Select all
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha);
Posted: Wed May 18, 2011 10:43 pm
by boywhoflies
I have pro. That works out well.
Thanks!

Posted: Tue Jul 05, 2011 3:12 am
by md
Ok, I've got another question.
For some reason, when I put a "+" sign between a text to separate it, it comes up with this error:
Code: Select all
___________________________________________
ERROR in
action number 23
of Draw Event
for object obj_controller:
Error in code at line 7:
"BONUS: " + global.bonus
^
at position 23: Wrong type of arguments to +.
But it doesn't do this to my other game when I use usernames!
Can someone please help me?
Thanks!
Code:
Code: Select all
{
draw_set_halign (fa_middle)
draw_text
(
view_xview+432,
view_yview+180,
"BONUS: " + global.bonus
);
}
I thought it might be because I was using a variable in my other game that was a word, so I might have something to do with numbers and word errors.
But still, it's confusing.
Posted: Tue Jul 05, 2011 5:46 am
by Blast!10
"BONUS: " is a string. global.bonus is a real value. It's called a type mismatch - you have to concatenate both values as strings, in this manner:
Code: Select all
"BONUS: " + string(global.bonus)
Posted: Tue Jul 05, 2011 6:29 am
by md
Blast!10 wrote:"BONUS: " is a string. global.bonus is a real value. It's called a type mismatch - you have to concatenate both values as strings, in this manner:
Code: Select all
"BONUS: " + string(global.bonus)
Thanks, I'll test it now!
Posted: Tue Jul 05, 2011 6:40 am
by md
It worked!
Thanks Blast!10!
