Skip to content

Instantly share code, notes, and snippets.

@chabiribon
Created January 20, 2015 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chabiribon/475f242a9985089af564 to your computer and use it in GitHub Desktop.
Save chabiribon/475f242a9985089af564 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class EnemyHop : MonoBehaviour {
public float JumpSpeed = 3.0f;
public float Xposition = 7;
public float Ywidth = 5;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.position = new Vector2( Xposition,Mathf.Abs( Mathf.Cos( Time.time * JumpSpeed )) * Ywidth );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment