[Solved] How to change sprite (main character) in endless runner

I’m making an endless runner game and I’m having a problem with ‘changing sprites in game’
For example: When I reach 2000 score, the main character will turn from a human to a vampire.
“He” will unlock/have different abilities upon changes.
Besides that, how can i change the lightning of the environment (day/night) along with the background?
it’s my first day using Gdevelop so my questions may seem dumb :frowning:

Thanks in advance

1 Like

Light is not in GD5. You can change the color of all your sprites or put a dark transparent sprite over the whole screen to get a ‘night’ effect.
As for changing the player character: just delete the old one and create the new one at his old position.

1 Like

You could use variables

For example

If VariableScore is greater than or equal to 2000
Then change the animation of player to the value of your animation

Just dont forget the trigger once

1 Like

I want to change character in mid-game too. but i want to it with button instead points.
i also want be able to change back to the first character.
my head is a mess and i dont understand variables.

you should. variables do the magic. and it’s not complicated.

i tried destroy/create but my new character dont functioning

omg i did it. only needed to make bihavior to second platformer character…duh

so how do i get so that charcter 2 start exacly were the first was destoyed?

its easy. just change the sequence. first create the new one at the old one’s position, after delete it. do both in the same line as now.

change the sequence?
only thing i can do is X and Y positions

sequence. order. sorry, I doesn’t speak english. the point is, you can’t create an object at another , if you deleted that. so, first create the new, ant after that delete the old.

ah, got very much thank you.

hmm problem persist. your tip on slimply create player2 and destroy player1 WORKED
player1 have one attack and player2 have another.
and i thought for myself, i want to reverse it, being able to switch character whenever i want.
button a for switch to player2 button d to switch to player1.
but… but when i create player1 again and destroy player2 he respawn under the floor and falls off the screen.
what can be wrong?

you forgot to rewrite the “X” to “Y” after [CTRL]+[C], [CTRL]+[V]. please pay attention to your work. the bug fix is part of jour job too.

I love you!
it was just a typ-o.
true, i should have spotted it myself.
anyways, cheers

1 Like