How did I make this? (Development)

Hello everyone! This is a dev log on how I've made Whale Runner.

Whale Runner was made in Unity (2017.3.0b3) using the new (ish) tileset feature. The hardest thing I had was destroying the tiles when the whale was there. The whole file (small) is below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class Whale : MonoBehaviour {
    public Tilemap tilemap;
    TileBase blank;
    public float increase = 0.08f;
    // Use this for initialization
    void Start () {
        blank = tilemap.GetTile(new Vector3Int(-1000, -1000, 0));
    // Update is called once per frame
    void FixedUpdate () {
        if (Player.doorOpen)
            transform.position = new Vector3(transform.position.x + increase, transform.position.y, transform.position.z);
            List<vector3int> positions = new List<vector3int>();
            List<tilebase> blanks = new List<tilebase>();
            for (int i = 0; i < 6; i++)
                positions.Add(new Vector3Int(Mathf.RoundToInt(transform.position.x + 5), i - 3, 0));
            tilemap.SetTiles(positions.ToArray(), blanks.ToArray());
            increase += 0.0003f;
            increase = Mathf.Clamp(increase, 0.08f, 0.09f);

The blank is found by getting the tile at: -1000, -1000 which is blank. The positions are found in a for loop, adding the tile positions for the height of the whale (i from 0 to 6, i - 3 for y). The x is transform.position.x + 5, because 5 is how big the whale is from the center.

This is the biggest problem I've had. Otherwise, the high score is saved using PlayerPrefs. PlayerPrefs.GetInt("highscore", 0) (0 is the default value) and also using PlayerPrefs.SetInt("highscore", Score.highscore) It's Score.highscore as I made a seperate Monobehavour class on the score text.

That's all I'm doing! If you have any more questions tell me in a comment on the itch page. Thanks!

Leave a comment

Log in with to leave a comment.