1
Support / Re: Changing polygon collider when changing spriteID
« on: September 17, 2012, 01:13:29 pm »
it's working, thx !
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class spawnEnemy : MonoBehaviour
{
public tk2dAnimatedSprite enemy;
public Color[] colorChoices;
public GameObject road;
public List<Transform> spawnPoint;
private tk2dAnimatedSprite target;
private int n = 0;
private int p = 0;
private Vector3 pos = new Vector3();
void Start()
{
p = Random.Range(0, colorChoices.Length);
n = Random.Range(0, spawnPoint.Count);
target = (tk2dAnimatedSprite)Instantiate(enemy, spawnPoint[n].transform.position, enemy.transform.rotation);
target.color = colorChoices[p];
target.transform.parent = road.transform;
pos = road.transform.position;
}}