GMK Help?

For discussion of non-Wonderland topics - please read rules!
Post Reply
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

GMK Help?

Post 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? :D
Thanks!!! :D :)
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
User avatar
MyNameIsKooky
Rainbow Spirit Master
Posts: 9701
Joined: Mon Dec 01, 2008 10:18 pm

Post 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.
User avatar
boywhoflies
Rainbow Spirit Chaser
Posts: 5510
Joined: Thu Jun 26, 2008 3:16 pm

Post 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?
Mr. Robot never dies! :D

Chatroom
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post 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! :D
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post 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! :D
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.
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post 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!!! :D :D :)
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
User avatar
boywhoflies
Rainbow Spirit Chaser
Posts: 5510
Joined: Thu Jun 26, 2008 3:16 pm

Post 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. :P
Mr. Robot never dies! :D

Chatroom
User avatar
Blast!10
Rainbow Star
Posts: 1631
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Post 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);
User avatar
boywhoflies
Rainbow Spirit Chaser
Posts: 5510
Joined: Thu Jun 26, 2008 3:16 pm

Post by boywhoflies »

I have pro. That works out well.
Thanks! :D
Mr. Robot never dies! :D

Chatroom
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post 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! :D

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.
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
User avatar
Blast!10
Rainbow Star
Posts: 1631
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Post 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)
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post 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!
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post by md »

It worked!

Thanks Blast!10! :D
If you bothered to copy and paste this signature, or zoom in, to make it possible to read, then I wasted 5-10 seconds of your life.
Post Reply