- Home /
NEWBIE - how to make move like a mario brothers
Hello,
I'm new. Can someone help me write a script that my character can pass through the edges of the screen?
I write only script for teleport but i don;t need teleports.
using UnityEngine;
using System.Collections;
public class teleport1 : MonoBehaviour {
public Transform target;
void OnTriggerEnter(Collider col){
if (col.tag == "Player"){
if (transform.position.x < 0)
col.gameObject.transform.position = new Vector3(transform.position.x+2.6f, transform.position.y-0.15f);
else
col.gameObject.transform.position = new Vector3(transform.position.x-2.6f, transform.position.y-0.15f);
}
}
}
I hope someone will help greetings
Comment
Hi barar, so you want your character to move pass the edge of screen but not teleport? Do you mean like, when mario moves to the edge, half of his body is shown on the other side of the screen?
Your answer
![](https://koobas.hobune.stream/wayback/20220613162827im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Smooth Camera Follow Script, Weird Movement... Please help! 1 Answer
Character running at super speed 1 Answer
Car movement script ? 1 Answer
Row Boat script 0 Answers
(Solved) Continuous movement 1 Answer