• 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 /
This question was closed May 17, 2014 at 10:58 AM by AlucardJay for the following reason:

Question is off-topic or not relevant

avatar image
0
Question by lullaharsh · May 17, 2014 at 10:37 AM · androidconvert

Convert the script to android

Please could someone take your busy time in converting these scripts

ZombieAnimator.cs

 using UnityEngine;
 using System.Collections;
 
 public class ZombieAnimator : MonoBehaviour {
 
     public Sprite[] sprites;
     public float framesPerSecond;
 
     private SpriteRenderer spriteRenderer;
 
     // Use this for initialization
     void Start () {
         spriteRenderer = renderer as SpriteRenderer;
     }
     
     // Update is called once per frame
     void Update () {
         int index = (int)(Time.timeSinceLevelLoad * framesPerSecond);
         index = index % sprites.Length;
         spriteRenderer.sprite = sprites[ index ];
     }
 }

ZombieController.cs

 using UnityEngine;
 using System.Collections;
 
 public class ZombieController : MonoBehaviour {
 
     public float moveSpeed;
     public float turnSpeed;
 
     private Vector3 moveDirection;
 
 
     // Use this for initialization
     void Start () {
         moveDirection = Vector3.right;
     }
     
     // Update is called once per frame
     void Update () {
 
         // 1
         Vector3 currentPosition = transform.position;
         // 2
         if( Input.GetButton("Fire1") ) {
             // 3
             Vector3 moveToward = Camera.main.ScreenToWorldPoint( Input.mousePosition );
             // 4
             moveDirection = moveToward - currentPosition;
             moveDirection.z = 0; 
             moveDirection.Normalize();
         }
 
         Vector3 target = moveDirection * moveSpeed + currentPosition;
         transform.position = Vector3.Lerp( currentPosition, target, Time.deltaTime );
 
         float targetAngle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
         transform.rotation = 
             Quaternion.Slerp( transform.rotation, 
                              Quaternion.Euler( 0, 0, targetAngle ), 
                              turnSpeed * Time.deltaTime );
     }
 }

Please I am new to Unity Android. I took this from a tut You can find it here:http://www.raywenderlich.com/61532/unity-2d-tutorial-getting-started

Comment
Add comment · Show 2
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 Jeff-Kesselman · May 17, 2014 at 10:42 AM 0
Share

You are likely to get more help if you try to do your own work and ask questions about problems you have then if you just ask other people to write your game for you.

of course you may just get lucky. I have seen it happen here..

avatar image robertbu · May 17, 2014 at 03:53 PM 2
Share

In posted as an "Answer" to another question this comment referencing the closure of this question:

why did you close my question idiot.

If you have questions about a closure, your comment belongs with the closure. It was closed because you asking for someone to do the work for you with a script you did not even write. Unity Answers focuses on answering single, specific technical questions to help you write your own code.

1 Reply

  • Sort: 
avatar image
0

Answer by meat5000 · May 17, 2014 at 10:51 AM

Indeed, you are lucky to get through moderation with this.

Unity will run the script in Android just by selecting the platform in Build settings.

What you will need to do is replace the input checks with a touch handler routine.

Check Angry Bots tutorial project in Android mode for examples on how to do this, or search Penelope iPhone tutorials which are also good for Android.

Comment
Add comment · 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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[Re-Edited] Clone Of Bejeweled for Android 3 Answers

How do I add bots in android? 2 Answers

Change position of GameObject between unity3d and eclipse 0 Answers

[Android] Why does my enemy die no matter where I am in the 3D environment? 1 Answer

TouchPhase not firing correctly - Android 3 Answers


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