- Home /
2D: How to make Gradius III with a mouse?
I'm working on a 2D side-scrolling ship control game similar to Gradius III for SNES. (Is there a better term for this genre?) Here's a sample, with the action starting around 0:30.
These are my trouble spots:
1: I want to control my ship with either the mouse or keyboard. Initially, I used another's code which made the unit a GUI element, but I forsee problems with various screen resolutions due to the offset. (When the game is windowed, the screen's coordinates usually aren't the window's coordinates.) Thus, how do I get the mouse control to work with a variety of resolutions?
2: I want a ship that can instantly change directions and stop on a dime. I tried disabling gravity on the ship, but that causes the ship to skid. How do I get tight controls in Unity?
3: How do I get selective collision? Since I want this game to be multiplayer, I want to check collision with the sides of the screen and with enemies, but not with other player ships.
Answer by ScroodgeM · Jul 21, 2012 at 07:00 PM
mouse coordinates are always have zero in bottom-left corner... also you can use Input.GetAxis("...") instead of position - this is position-independent
you can use rigidbody as kinematics and control ship directly using MovePosition method of rigidbody - it is always instantly
use different layers for objects and players, then check collision matrix - you can disable collision between 'player' layers at all