Being an indie game dev and all, I have to minimize time spent on the game or I’ll quickly end up burning myself out. So oftentimes, I reuse scripts I wrote before for different purposes. For the Protus Raider ship, I reused the “Suicide Ship” script for this ship:
The first order of business was to make the ship fly back up towards the player in an arc. This was done using Rigidbody.Rotate and a couple of if statements. The general approach was to make sure the enemy wasn’t in the menu, the player wasn’t dead, etc and then make sure the Raider was below the player’s Y position. If it was and the X position is less than the player’s X position, then rotate to the right. Otherwise, if the X position is greater than the player’s X position, rotate to the left. The speed is determined by a public floating point variable in the inspector.
The rest of the code is mostly just plucked right from the suicide ship, and the result is that the ship was made in under an hour. Sometimes the best solutions are the least elegant :-)
0 comments