Jump to content


Photo

Image Number Confusion


  • Please log in to reply
7 replies to this topic

#1 lrmlrm

lrmlrm

    GMC Member

  • New Member
  • 22 posts
  • Version:GM8

Posted 06 July 2012 - 01:01 PM

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) ?
  • 0

#2 YellowAfterlife

YellowAfterlife

    GMC Member

  • Global Moderators
  • 3490 posts
  • Version:GM:Studio

Posted 06 July 2012 - 01:05 PM

inst = instance_create(x, y, dead_enemy_obj)
inst.image_index = image_index
I also recommend to use built-in functionality for rotating images (image_angle, draw_sprite_ext) unless absolutely needed.
  • 0

#3 HerpDerp

HerpDerp

    GMC Member

  • New Member
  • 215 posts
  • Version:GM8

Posted 06 July 2012 - 01:08 PM

Yellow beat me to it :tongue:

Indeed. In case you use LITE, image_angle at least is now available for it.
  • 0

#4 lrmlrm

lrmlrm

    GMC Member

  • New Member
  • 22 posts
  • Version:GM8

Posted 06 July 2012 - 01:10 PM

inst = instance_create(x, y, dead_enemy_obj)
inst.image_index = image_index
I 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
  • 0

#5 HerpDerp

HerpDerp

    GMC Member

  • New Member
  • 215 posts
  • Version:GM8

Posted 06 July 2012 - 01:17 PM


inst = instance_create(x, y, dead_enemy_obj)
inst.image_index = image_index
I 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.
  • 0

#6 lrmlrm

lrmlrm

    GMC Member

  • New Member
  • 22 posts
  • Version:GM8

Posted 06 July 2012 - 01:53 PM



inst = instance_create(x, y, dead_enemy_obj)
inst.image_index = image_index
I 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();
  • 0

#7 HerpDerp

HerpDerp

    GMC Member

  • New Member
  • 215 posts
  • Version:GM8

Posted 06 July 2012 - 02:04 PM




inst = instance_create(x, y, dead_enemy_obj)
inst.image_index = image_index
I 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?
  • 0

#8 lrmlrm

lrmlrm

    GMC Member

  • New Member
  • 22 posts
  • Version:GM8

Posted 06 July 2012 - 02:45 PM





inst = instance_create(x, y, dead_enemy_obj)
inst.image_index = image_index
I 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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users