(SOLVED) How do I change the player sprite with another....

0 favourites
  • 10 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi friends!!!

    Is it possible to change the player sprite with another maintaining the same name so to maintaining also the animations and all the instances ?

    I mean that if it was possible to "load" the player sprite from a file, so in this case I would have the same instances and animations name.

    any advice would be appreciated!!!

  • well. juste open your sprite and "open file" and chose another image. The name doesn't change

  • You would also need to change the animations.

  • Sorry, I have explained badly...

    I want to open the "new player" sprite file from the event code..... I need this because i want to use another player sprite when for example the player evolve in other sprite.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The way I usually handle that is to use an invisible sprite for the player - to keep instance variables, the position on screen, and keep all the events as simple as possible. Then you can pin any sprite you want on top, change animations as necessary, etc...

  • Much easier than using "another" sprite is to simply add it as another animation to your existing sprite. If you really need to use a different sprite, then AllanR is on the right track. Use an invisible sprite as your actual controllable character and just pin a visible sprite to it and that is what the player sees. You can then just pin whichever sprite you want as the visual representation of your character.

  • Here an example of the code where the player goes left and right with animation "sinistra" and "destra".

    Now.... I want to "load" or something like that and replace the "pg" sprite with another sprite that have the same name and same names of all animations, in order to avoid to reprogram all the instances.

    Something like that :

    _ load sprite "pg1.png" to PG SPRITE ( i cant choose from two or more player sprite, for example : pg1.png, pg2.png etc... )

    _ right arrow is down -> PG SPRITE set animation to "right" etc....

    So the name PG SPRITE remain the same, and all the animations like "right" , "left" , "jump" etc. remain the same.

    I hope it's clear now, i'm sorry for the bad english!

  • Yes, i can add many animations as many different player i need, but in this case i need to duplicate all the code in order to check which sprite i'm using in that moment.

    For example:


    • left, right, jump, etc.. (with the image of the first player for example a dog!)

    -left, right, jump, etc.. (with the image of the second player for example a cat!)

    and so on...

    Is this the only solution ?

  • It's possible to use : set animation to "left"+ x ?

    so in the code i will use: if PG = 1 then X = 1

    and in the animations panel : left1 of pg1, left 2 of pg2 , etc...

    I cand happend a string to another ?

  • Ok, i used a global text pgused = "1"

    player1 set animation to "left" & pgused (in this case will play the animation called "left1")

    It works well!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)