Legacy GM Drawing many instances at a time.

T

Thexel PIN

Guest
So this is my code:
Code:
if instance_exists(obj_enemybullet) {
if obj_enemybullet.sprite_index != -1 {
draw_sprite_ext(obj_enemybullet.sprite_index,obj_enemybullet.image_index,obj_enemybullet.x,obj_enemybullet.y+altitude,obj_enemybullet.image_xscale,obj_enemybullet.image_yscale,obj_enemybullet.image_angle,c_black,obj_enemybullet.image_alpha*0.5);
}}
You can see I'm drawing "obj_enemybullet". It works fine, but there are many instances of it and I need it to draw them all. How can I do that?
 
T

Thexel PIN

Guest
And here's the thing:
1. Can you draw through a with?
2. If I do that, the objects will draw themselves in the same depth. I need a different object with bigger depth to draw them.
 

TheouAegis

Member
with obj_enemybullet {
y += other.altitude;
image_alpha /= 2;
draw_self();
y -= other.altitude;
image_alpha *= 2;
}
 

FrostyCat

Redemption Seeker
And here's the thing:
1. Can you draw through a with?
2. If I do that, the objects will draw themselves in the same depth. I need a different object with bigger depth to draw them.
1. with is just a looping construct. If it is put in a place where drawing functions make sense (i.e. a Drawing event), then you can draw with it.
2. with does not change the drawing depth to that of the instances being accessed, quit believing that myth. Put the with in the object with the higher depth and it will draw at that higher depth.
 
Top