Animalien Invaders 2D Laser Defender Game, Part 1

Home / Technology / Game Development / Animalien Invaders 2D Laser Defender Game, Part 1
It's week 5 of Summer of Code 2019. This week, I started developing Animalien Invaders, a 2d laser defender game in Unity. Read more at

Animalien Invaders = Animal + Alien + Invaders.

Now that we have that out of the way, it’s time to dive into my Unity game project for this week (and next, and possibly the week after).

What I Learned

  • Reinforced prior game concepts, from importing assets to setting up a scene with sprites, canvas, game assets, etc.
  • The basics of developing a very simple game design document. This includes a gameplay screen mockup and core game design features like player experience, core mechanics, theme, and game loop
  • How to obtain free game assets from Kenney. These are really great assets you can download and use in all your game projects. Be sure to check them out!
  • How to use Time.deltaTime to ensure that the game is independent of frame rate. (i.e. it will run at the exact same speed on any device, regardless of frame rate)
  • Using ViewportToWorldPoint() to move the player object based on where it is in relation to the camera, from (0,0) to (1,1)
  • A logical approach to determining “what comes next” when deciding what feature to implement in game development process

The Animalien Invaders 2D Laser Defender Game

As the name suggests, Animalien Invaders is a top-down 2D laser defender game in which you, the player, must defend the earth against alien animal invaders. Think elephants, zebras, sloths, chickens and penguins, but like, evil versions flying in on their weird little space ships, ready to take over the world.

I haven’t made it very far in developing this game, yet. I have been rather distracted this week with everything going on. Fortunately, I did manage to begin getting the player set up and added code for the player’s movement vertically and horizontally using the keyboard.

Game Script


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
    [SerializeField] float moveSpeed = 10f;
    [SerializeField] float padding = 1f;

    float xMin , xMax , yMin, yMax;

    // Start is called before the first frame update
    void Start()

    // Update is called once per frame
    void Update()

    private void Move()
        // Horizontal
        var deltaX = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
        var newXPos = Mathf.Clamp(transform.position.x + deltaX, xMin, xMax);

        // Vertical
        var deltaY = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
        var newYPos = Mathf.Clamp(transform.position.y + deltaY, yMin, yMax);

        transform.position = new Vector2(newXPos, newYPos);

    private void SetUpMoveBoundaries()
        Camera gameCamera = Camera.main;
        xMin = gameCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).x + padding;
        xMax = gameCamera.ViewportToWorldPoint(new Vector3(1, 0, 0)).x - padding;
        yMin = gameCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).y + padding;
        yMax = gameCamera.ViewportToWorldPoint(new Vector3(0, 1, 0)).y - padding;

What features do you want to see?

There’s still a lot left to do, but I am really excited about continuing to work on this next week and eventually expanding it eventually into a full game.

Next week, I will begin adding sprites and code to make the character shoot. Then I can work on making the enemy spawn and move around the screen. After that, who knows? What features would you like to see? Let me know!

Also, if you enjoy reading content like this, be sure to subscribe below to get alerts in your inbox when I post something new. ❤

Join 1,467 other subscribers
It's week 5 of Summer of Code 2019. This week, I started developing Animalien Invaders, a 2d laser defender game in Unity. Read more at

Let's chat!

%d bloggers like this: