x


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.

more ▼

asked Jul 21 '12 at 01:10 AM

Endarire gravatar image

Endarire
24 3 6 8

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
  1. mouse coordinates are always have zero in bottom-left corner... also you can use Input.GetAxis("...") instead of position - this is position-independent

  2. you can use rigidbody as kinematics and control ship directly using MovePosition method of rigidbody - it is always instantly

  3. use different layers for objects and players, then check collision matrix - you can disable collision between 'player' layers at all

more ▼

answered Jul 21 '12 at 07:00 PM

ScroodgeM gravatar image

ScroodgeM
7.6k 2 6

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2499
x1370
x983
x224

asked: Jul 21 '12 at 01:10 AM

Seen: 286 times

Last Updated: Jul 21 '12 at 07:01 PM