I’ve been trying to figure out how I would do a code that would be for my University project on a 2D Sidescroller Spaceship game.
The way this works is when the spaceship crashes in to a collider, I want the sprite to change to a different one which will be the same sprite, just I added a darker effect to it in Photoshop, and as it hits the collider of three times, eventually the GameObject will destroy and the level will fade out and restart.
Would it be best to do this on JS or C#? Can anyone get me started?
In general the answer is you create the new object in the scene, copy the transform matrix from the old one, and delete the old one.
Alternately, you could avoid the transform copy by making the object have an empty parent object and just replace the children.