Guides
Log In

Completing Jump Map by moving game objects and teleports

Sample Project

๐Ÿ“˜

Project files used in lecture videos

https://github.com/naverz/zepeto-world-sample/tree/main/Assets/Chapter1


Summary

Summary- This is a follow-along lecture for beginners of ZEPETO World development.
- Set up for ZEPETO World development and learn ZEPETO character controller.
- It is a Jump Map that can be completed with a simple game object movement code and a teleport code.
DifficultyBeginner
Time Required30 Minutes

Project Goals

  • Understand how to create Unity projects using ZEPETO templates
  • World ID Interwork and ZEPETO Login
  • Summon ZEPETO characters and understand character controllers
  • Create default Jump Maps
  • Control the movement of game objects using ZEPETO script
  • Teleport characters using ZEPETO script

Example of Completed World



Part 1. Setting up the World Console

โ—๏ธ

Caution

Before watching this video, please follow the Unity Installation and ZEPETO Template Registration Guide to complete the basic installation.

  • Learn how to set up the ZEPETO Studio World Console.
  • Learn how to set up Unity projects using ZEPETO Template.

Part 2. Setting up ZEPETO Players

  • Learn how to make ZEPETO Characters appear in the World.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { SpawnInfo, ZepetoPlayers, LocalPlayer, ZepetoCharacter } from 'ZEPETO.Character.Controller';
 
export default class CharacterController extends ZepetoScriptBehaviour {

   Start() {        
       ZepetoPlayers.instance.CreatePlayerWithZepetoId("", "[ZEPETO_ID]", new SpawnInfo(), true);
       ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
           let _player : LocalPlayer = ZepetoPlayers.instance.LocalPlayer;
       });
   }
}

Part 3. Moving game objects

  • Learn how to create a moving game object.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';

export default class Rotator extends ZepetoScriptBehaviour {

    public rotationSpeedX: number = 0.5;
    public rotationSpeedY: number = 0;
    public rotationSpeedZ: number = 0;

    Update() {
        this.transform.Rotate(this.rotationSpeedX, this.rotationSpeedY, this.rotationSpeedZ);
    }
}
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { Vector3, GameObject, Object, Time } from 'UnityEngine';

export default class Movement extends ZepetoScriptBehaviour {

    public movingTime: number = 1;
    public movingRangeX: number = 0;
    public movingRangeY: number = 2;
    private delta: number = 0;
    private directionFlag: bool = true;

    Update() {
        this.delta += Time.deltaTime;
        if (this.delta > this.movingTime) {
            this.delta = 0;
            this.directionFlag = !this.directionFlag;
        }

        if (this.directionFlag) {
            // Move upward during the set moving time
            this.transform.Translate(this.movingRangeX * Time.deltaTime, this.movingRangeY * Time.deltaTime, 0);
        } else {
            // Move downward during the set moving time
            this.transform.Translate(-1 * this.movingRangeX * Time.deltaTime, -1 * this.movingRangeY * Time.deltaTime, 0);
        }
    }
}

Part 4. Teleporting ZEPETO Characters

  • Learn to teleport characters when they reach the object.
import { Collider,Vector3,Quaternion } from 'UnityEngine';
import { ZepetoCharacter, ZepetoPlayer, ZepetoPlayers } from 'ZEPETO.Character.Controller';
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';

export default class Teleport extends ZepetoScriptBehaviour {

    private zepetoCharacter: ZepetoCharacter;

    Start() {
        // Zepeto character object
        ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
            this.zepetoCharacter = ZepetoPlayers.instance.LocalPlayer.zepetoPlayer.character;
        });
    }

    OnTriggerEnter(collider: Collider) {
        if (this.zepetoCharacter == null || collider.gameObject != this.zepetoCharacter.gameObject) {
            return;
        }

        // Teleport to Origin Position
        this.zepetoCharacter.Teleport(new Vector3(0, 0, 0), Quaternion.identity);
    }
}

Part 5. Test Play

  • Learn how to test play on mobile.

Part 6. Utilizing Asset Store

  • Learn how to lavishly decorate your World.

Part 7. Launching the World

  • Learn how to launch the World.