How to switch between pictures for an actor?
Game Factory
Member Posts: 34
How do I get the picture or image asset for my actor to change when I'm doing certain things? For example say my player is running and I swipe down to slide under something, how do I get the picture to change from the running picture to the sliding picture and then change back when the slide is over?
Comments
there is a change image behavior.
so when sliding change image to sliding image and if running change image to running image (or use the animate behavior for animation)
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
@timolapre1998 thanks! so say my normal standing or running actor image is to big to go under something but my sliding image will go under it. if i do the way you say will it go under there with the sliding picture or do i need to create multiple actors for it? hope i explained that well
Its not based on the image , its based on the size of your actor , if it collides or not. You can for example say if self.image = slidingimage.png do nothing , otherwise collide , or have a condition if slide is true , change the actor width and height to fit under. Or you can destroy and spawn a new actor but i wouldnt recommend that. The image wont change anything , your actor will remain the same size even if you put a smaller image it would just stretch to fit the actor size and it will continue to collide.
Thank's! Another thing, how can I make it to where my player can run on the top of a platform or hit the bottom of it without anything happening but if they hit the side they die?
I think the easiest way would be to add an invisible actor to the sides call it Death or whatever you want , in your hero actor if overlaps or collides with Actor death , destroy or whatever your method is to make the actor die.