Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PonchoSam · Mar 27, 2011 at 06:33 AM · camerartsshipbattle-system

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.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Muzz 1 · Mar 27, 2011 at 09:14 AM 0
Share

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.)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Scribe · Mar 27, 2011 at 11:31 AM

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Scribe · Mar 27, 2011 at 11:34 AM 0
Share

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

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

move camera to clicked object 0 Answers

Smooth camera height adjustment based on terrain 1 Answer

How to make camera position relative to a specific target. 1 Answer

RTS Camera Script: Mapbounds and Camerascroll (C#) 1 Answer

Some questions about RTS games 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges