GMK Help?

For discussion of non-Wonderland topics - please read rules!

Moderators: ~xpr'd~, tyteen4a03, Stinky, Emerald141, Qloof234, jdl

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

GMK Help?

Post by md » Mon May 16, 2011 7:59 am

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 &#40;obj_boss1.HP<1&#41;
     &#123;
      instance_destroy&#40;&#41;
     &#125;;
    &#125;
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: 9712
Joined: Mon Dec 01, 2008 10:18 pm

Post by MyNameIsKooky » Mon May 16, 2011 10:45 am

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 » Mon May 16, 2011 8:55 pm

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 » Tue May 17, 2011 5:53 am

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.
&#123;
 draw_healthbar
 &#40;
  220,
  view_yview+35,
  420,
  view_yview+55,
  HP,
  noone,
  c_fuchsia,
  c_fuchsia,
  0,
  0,
  1
 &#41;;
&#125;
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 » Tue May 17, 2011 5:58 am

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.
&#123;
 draw_healthbar
 &#40;
  220,
  view_yview+35,
  420,
  view_yview+55,
  HP,
  noone,
  c_fuchsia,
  c_fuchsia,
  0,
  0,
  1
 &#41;;
&#125;
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 » Tue May 17, 2011 10:11 am

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 » Tue May 17, 2011 8:34 pm

I see what happened.
You drew the healthbar, which disabled the sprite. In those cases, I use this code:

Code: Select all

draw_sprite&#40;sprite_index,image_index,x,y&#41;
. 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: 1739
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Post by Blast!10 » Wed May 18, 2011 12:36 pm

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&#40;sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha&#41;;
User avatar
boywhoflies
Rainbow Spirit Chaser
Posts: 5510
Joined: Thu Jun 26, 2008 3:16 pm

Post by boywhoflies » Wed May 18, 2011 10:43 pm

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 » Tue Jul 05, 2011 3:12 am

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&#58;

Error in code at line 7&#58;
     "BONUS&#58; " + global.bonus
                        ^
at position 23&#58; 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

&#123;
 draw_set_halign &#40;fa_middle&#41;
 draw_text
 &#40;
  view_xview+432,
  view_yview+180,
  "BONUS&#58; " + global.bonus
 &#41;;
&#125;
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: 1739
Joined: Thu Nov 02, 2006 7:26 pm
Location: New Hampshire

Post by Blast!10 » Tue Jul 05, 2011 5:46 am

"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&#58; " + string&#40;global.bonus&#41;
User avatar
md
Rainbow Master
Posts: 748
Joined: Wed Oct 17, 2007 9:26 am

Post by md » Tue Jul 05, 2011 6:29 am

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&#58; " + string&#40;global.bonus&#41;
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 » Tue Jul 05, 2011 6:40 am

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