descrubb
Member
As far as I know about lists, they start at 0 and new entries are added onto "the end"... yup that's about it.
With the `bullet_obj` i am usually only moving them around and destroying them if they hit another object
Right now, only a few of the bullets in the list are being deleted
Usually there are 6 - 8 objects in the projectile list
Any suggestions are welcome! Thank you
Create Code:
Add Code:
Bullet_obj destroy event:
Delete code:
ALWAYS has 1-2 undefined at least
debug messages :
With the `bullet_obj` i am usually only moving them around and destroying them if they hit another object
Right now, only a few of the bullets in the list are being deleted
Usually there are 6 - 8 objects in the projectile list
Any suggestions are welcome! Thank you
Create Code:
GML:
projectile_list = ds_list_create()
Add Code:
GML:
obj = instance_create_layer(x, y, "Instances", bullet_obj)
ds_list_add(projectile_list, obj)
GML:
with master_id {
// other is bullet
// self is shooter of bullet
var index = ds_list_find_index(self.projectile_list, other.id)
ds_list_delete(self.projectile_list, index)
}
Delete code:
GML:
var size = ds_list_size(projectile_list)
if size > 0
{
for (var i = 0; i < size; i++)
{
var bullet = projectile_list[| i]
if !is_undefined(bullet) {
instance_destroy(bullet)
show_debug_message("deleted " + string(bullet))
}
else {
show_debug_message("undefined")
}
}
ds_list_clear(projectile_list)
}
debug messages :
Code:
deleted 100041
deleted 100043
deleted 100045
undefined
undefined
undefined
Last edited: