So my game is a top view so my enemy uses 60 images to rotate 360 degrees to follow my character around the room.
Now I want a new sprite to come up when the enemy dies with just some blood covered and him fallen down. The new sprite has 60 images aswell for rotating but..
Only problem is I don't know how to make it face the same way it was when it was alive (using the other sprite)
So i was wondering if there was a code something like this to make it work..?
dead_enemy_obj = enemy_obj(image_index) ?
Image Number Confusion
Started by lrmlrm, Jul 06 2012 01:01 PM
7 replies to this topic
#1
Posted 06 July 2012 - 01:01 PM
#2
Posted 06 July 2012 - 01:05 PM
inst = instance_create(x, y, dead_enemy_obj) inst.image_index = image_indexI also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
#3
Posted 06 July 2012 - 01:08 PM
Yellow beat me to it
Indeed. In case you use LITE, image_angle at least is now available for it.
Indeed. In case you use LITE, image_angle at least is now available for it.
#4
Posted 06 July 2012 - 01:10 PM
inst = instance_create(x, y, dead_enemy_obj) inst.image_index = image_indexI also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
Didnt work, my enemy just dissapeared but didnt create the new instance
#5
Posted 06 July 2012 - 01:17 PM
inst = instance_create(x, y, dead_enemy_obj) inst.image_index = image_indexI also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
Didnt work, my enemy just dissapeared but didnt create the new instance
Put Yellow's code on the last 2 lines before the instance is destroyed when it's dying.
#6
Posted 06 July 2012 - 01:53 PM
inst = instance_create(x, y, dead_enemy_obj) inst.image_index = image_indexI also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
Didnt work, my enemy just dissapeared but didnt create the new instance
Put Yellow's code on the last 2 lines before the instance is destroyed when it's dying.
Okay well the dead body is showing but its still facing the way of the first subimage, not the way the live one was looking
Also here is the code i have under step
if enemyhealth < 1 {
global.money +=100
inst = instance_create(Penguin_O.x, Penguin_O.y, Dead_Penguin_O)
inst.image_index = image_index
instance_destroy();
#7
Posted 06 July 2012 - 02:04 PM
inst = instance_create(x, y, dead_enemy_obj) inst.image_index = image_indexI also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
Didnt work, my enemy just dissapeared but didnt create the new instance
Put Yellow's code on the last 2 lines before the instance is destroyed when it's dying.
Okay well the dead body is showing but its still facing the way of the first subimage, not the way the live one was looking
Also here is the code i have under step
if enemyhealth < 1 {
global.money +=100
inst = instance_create(Penguin_O.x, Penguin_O.y, Dead_Penguin_O)
inst.image_index = image_index
instance_destroy();
Hmm, maybe the way you draw the sprite in the object Penguin_O is changing the image_index
you copied inside it's drawing code. What's the code for that draw_sprite?
#8
Posted 06 July 2012 - 02:45 PM
inst = instance_create(x, y, dead_enemy_obj) inst.image_index = image_indexI also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
Didnt work, my enemy just dissapeared but didnt create the new instance
Put Yellow's code on the last 2 lines before the instance is destroyed when it's dying.
Okay well the dead body is showing but its still facing the way of the first subimage, not the way the live one was looking
Also here is the code i have under step
if enemyhealth < 1 {
global.money +=100
inst = instance_create(Penguin_O.x, Penguin_O.y, Dead_Penguin_O)
inst.image_index = image_index
instance_destroy();
Hmm, maybe the way you draw the sprite in the object Penguin_O is changing the image_index
you copied inside it's drawing code. What's the code for that draw_sprite?
I dont have any code for draw_sprite?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











