Jump to content


Photo

Change sprite of an object


  • Please log in to reply
9 replies to this topic

#1 naseem142

naseem142

    GMC Member

  • New Member
  • 100 posts
  • Version:GM8

Posted 03 June 2012 - 08:29 AM

How can i change sprite of an object when it gets touched by a bullet object
Please help

Thanks alot
  • 0

#2 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 08:39 AM

How can i change sprite of an object when it gets touched by a bullet object
Please help

Thanks alot

easy peasy:
one way is using a DnD action
Posted Image choose your sprite!
code:
sprite_index = your_sprite_name;
image_index = 0; // it is the subimage 0 to your max number!
// or use:
draw_sprite(sprite_name,image_index,x,y) // this goes in the draw event!
look up (draw_) for more draw stuff!
  • 0

#3 naseem142

naseem142

    GMC Member

  • New Member
  • 100 posts
  • Version:GM8

Posted 03 June 2012 - 08:44 AM


How can i change sprite of an object when it gets touched by a bullet object
Please help

Thanks alot

easy peasy:
one way is using a DnD action
Posted Image choose your sprite!
code:
sprite_index = your_sprite_name;
image_index = 0; // it is the subimage 0 to your max number!
// or use:
draw_sprite(sprite_name,image_index,x,y) // this goes in the draw event!
look up (draw_) for more draw stuff!


Can you see whats wrong with this:
when the object gets hit it doesn't change sprite
http://i1081.photobucket.com/albums/j360/naseem142/oigp.png

EDIT: Don't mind the code in the first line , it just decreases enemy's health by one and i don't think it interrupts everything else

Edited by naseem142, 03 June 2012 - 08:46 AM.

  • 0

#4 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 08:47 AM



How can i change sprite of an object when it gets touched by a bullet object
Please help

Thanks alot

easy peasy:
one way is using a DnD action
Posted Image choose your sprite!
code:
sprite_index = your_sprite_name;
image_index = 0; // it is the subimage 0 to your max number!
// or use:
draw_sprite(sprite_name,image_index,x,y) // this goes in the draw event!
look up (draw_) for more draw stuff!


Can you see whats wrong with this:
when the object gets hit it doesn't change sprite
http://i1081.photobu...eem142/oigp.png

what is sprite40 and sprite38?
also what is in the script?
alarm 11 event? (it is alarm 11 not alarm 0) Posted Image

Edited by creators124, 03 June 2012 - 08:56 AM.

  • 1

#5 naseem142

naseem142

    GMC Member

  • New Member
  • 100 posts
  • Version:GM8

Posted 03 June 2012 - 08:54 AM




How can i change sprite of an object when it gets touched by a bullet object
Please help

Thanks alot

easy peasy:
one way is using a DnD action
Posted Image choose your sprite!
code:
sprite_index = your_sprite_name;
image_index = 0; // it is the subimage 0 to your max number!
// or use:
draw_sprite(sprite_name,image_index,x,y) // this goes in the draw event!
look up (draw_) for more draw stuff!


Can you see whats wrong with this:
when the object gets hit it doesn't change sprite
http://i1081.photobu...eem142/oigp.png

what is sprite40 and sprite38?
also what is in the script?
alarm 0 event?



okay here is everything

http://i1081.photobucket.com/albums/j360/naseem142/dhfjhjh.png

EDIT: alarm 11 is a sound

Edited by naseem142, 03 June 2012 - 08:54 AM.

  • 0

#6 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 09:00 AM


<snip>
what is sprite40 and sprite38?
also what is in the script?
alarm 0 event?



okay here is everything

http://i1081.photobu...142/dhfjhjh.png

EDIT: alarm 11 is a sound

ok one more thing just tell me what is the "if there is a collision at a posi"?!
but It think you should put the script at the end!
  • 1

#7 naseem142

naseem142

    GMC Member

  • New Member
  • 100 posts
  • Version:GM8

Posted 03 June 2012 - 09:55 AM

I still need help :S
  • 0

#8 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 461 posts
  • Version:GM8.1

Posted 03 June 2012 - 10:10 AM

Take out the 'Change sprite to sprite38'
  • 1

#9 naseem142

naseem142

    GMC Member

  • New Member
  • 100 posts
  • Version:GM8

Posted 03 June 2012 - 10:11 AM

Nvm i figured it out , iv set an alarm leading to another alarm. the first alarm will change the sprite of the object and then the second alarm will change the sprite back to normal.

But thanks for trying to help :)
+1
  • 0

#10 creators124

creators124

    awesomeliciousmember

  • GMC Member
  • 866 posts
  • Version:GM8

Posted 03 June 2012 - 10:13 AM

I still need help :S

what sprite are you trying to change to!
you flash in one step as sprite 40 then to sprite 38!
no idea why you need that collision check inside the collision event! (USELESS!)
please tell us!
EDIT:
WOW!
I'm getting ninja'd too much! Posted Image

Edited by creators124, 03 June 2012 - 10:14 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users