x


Simple RTS components.

I am trying to make a bare-bones-ish RTS style game, in which each player uses several boats to kill the other players' boats. I broke down what I need to complete this project, and want to see if any of these components have already been made.

  1. A top-down camera that can scroll when the mouse is moved to the edge of the screen.
  2. An RTS-style unit selection rectangle, so that you can select your boats and move them with a point-click.
  3. A battle system so that when a ship gets close enough to another ship, they kill each other.
  4. a battle system so that you can target an enemy boat with your boat.
  5. multiplayer?

It would be awesome if any of these were already in existence so that I don't have to try to make them myself. I would probably end up with cluttered monstrosities of code.

more ▼

asked Mar 27 '11 at 06:33 AM

PonchoSam gravatar image

PonchoSam
1 1 1 1

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

2 answers: sort voted first

In the Unity Forums, there is a nice tank C&C community project. You could try and integrate some of that (I think it was in the Collaboration section.)

more ▼

answered Mar 27 '11 at 09:14 AM

Muzz 1 gravatar image

Muzz 1
548 52 59 71

(comments are locked)
10|3000 characters needed characters left
var CamSpeed = 1.00;
var GUIsize = 25;

function Update () {
var recdown = Rect (0, 0, Screen.width, GUIsize);
var recup = Rect (0, Screen.height-GUIsize, Screen.width, GUIsize);
var recleft = Rect (0, 0, GUIsize, Screen.height);
var recright = Rect (Screen.width-GUIsize, 0, GUIsize, Screen.height);

    if (recdown.Contains(Input.mousePosition))
        transform.Translate(0, 0, -CamSpeed, Space.World);

    if (recup.Contains(Input.mousePosition))
        transform.Translate(0, 0, CamSpeed, Space.World);

    if (recleft.Contains(Input.mousePosition))
        transform.Translate(-CamSpeed, 0, 0, Space.World);

    if (recright.Contains(Input.mousePosition))
        transform.Translate(CamSpeed, 0, 0, Space.World);
}

when I was doing an RTS type game before I made this script for my camera so maybe it will help you.

It creates a non-visible rectangle on the side of the screen with an inset of 25 (var called GUIsize) when the mouse enters these areas it moves the camera in world coordinates (I made it world coordinates as my camera was angled at about 45 degrees like the total war games if you've ever played them)

You can change the cam speed to alter the speed of the cameras movement

Hope it helps you

Scribe

more ▼

answered Mar 27 '11 at 11:31 AM

Scribe gravatar image

Scribe
1.4k 12 16 34

just thought id add that moving to the corners of the screen moves the camera diagonally

Mar 27 '11 at 11:34 AM Scribe
(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:

x2987
x155
x32
x5

asked: Mar 27 '11 at 06:33 AM

Seen: 1953 times

Last Updated: Mar 27 '11 at 06:33 AM