Jump to content


aicom

Member Since 31 Jul 2012
Offline Last Active Apr 06 2013 08:04 PM

Topics I've Started

Draw_Sprite_Part Meter

01 April 2013 - 08:19 PM

Hi

 

I'm trying to draw a horizontal healthbar/meter with a sprite and the draw_sprite_part function. The sprite is 35x8, with its origin at 0,0, drawn at 181,12. The variable used (global.charge) has a max of 350. This code has had no success, nothing gets drawn.

 

draw_sprite_part(interface_meter,0,0,0,global.charge/10,sprite_height,181,12);
 

Does anybody know how to fix this?

 

Thanks in advance!


Check If Object Exists Inside Room Boundaries

30 March 2013 - 10:20 PM

Hi

 

The title says it all! I have:

 

 

if instance_exists(enem_parent){...}
 

But how do i check at the same time if this instance is inside the room boundaries? Can't get my head around this...

 

Thanks in advance!


Nearest Enemy Variable Unknown

29 March 2013 - 12:23 PM

Hi

 

In my game, a sideweapon has to shoot the nearest enemy. All enemies have the same parent (enem_parent). This is in the step event:

 

 

 

var enem_nearest;
enem_nearest = instance_nearest(x,y,enem_parent);
 

 

And this is the code for the shooting itself, on an alarm event:

 

 

      if shots_left > 0{
         if enem_nearest != -1{
            with instance_create(x+1,y,obj_plship_bullet){move_towards_point(enem_nearest.x,enem_nearest.y,16);}
            instance_create(x+1,y-10,obj_plship_fire);
            shots_left -= 1;
            alarm[0] = 5;
            alarm[1] = 30
         }
      }
 

Why do I get the "variable unknown" error, while the var is clearly stated in the step event? Any ideas on how to correct this code?

 

Thanks in advance!

Robin


Sprite_Index + Object Replace Problems

20 March 2013 - 09:43 PM

Hi

 

For my shmup i'm creating...

I have two sprites, one for the player's ship (not animated) and one for the player's ship when invulnerable after losing a life (animated; flashing white). When I want to change from the first to the second, nothing changes... How do I change to a sprite that animates?

 

This is my code, in an alarm event:

global.hp = 100;
global.exploding = 0;

vspeed = 0;
gravity = 0;

sprite_index = plship_go;
image_speed = 0.2;

x = 120;
y = 260;  

 

 

Also, my object stays on the given x and y; the player is unable to move while I don't see why...

 

Any suggestions?

Thanks in advance


Increase/Decrease Variable One By One?

20 March 2013 - 03:01 PM

Hi

 

I was wondering how to in/decrease any variable (score, health,...) not all at once, but in a small amount of time, so it's possible to see it changing one by one.


Figured this would be possible with some kind of for/while loop, but I don't exactly know how...

 

Any suggestions?

Thanks in advance