Thursday, February 16, 2023

Foundation Year Final Project: Production Week 1.

I've been working on a Foundation Year project for the past 4 weeks, and most of it has been for Pre-Production. While I've done a bit of code already for menus, on Tuesday, I started creating code and functionality for my player.

I found a free asset pack on Itch.io for isometric character movements, which I used for the player. 

I followed a tutorial on YouTube to create a script that allowed the player to move in 8 directions.

I did this by creating 2 functions. The first function updates the player's movementDirection variable by grabbing  the player's input. 



The second function uses the MovePosition() function to move the player based on the newly refreshed movementDirection variable. It works by adding the players position with the direction and the movementSpeed variable multiplied by Time.FixedDeltaTime.


Someone on Discord suggested I used Blend Trees for my animation, and the concept would soon come up on the tutorial video that I was following. The difference between the video tutorial and my game was that I was also using animations for SW, SE, NW, and NE. 


I setup the game so that the player's default state is the "Idling" blend tree. Once the player gains speed, it moves to the "Walking" blend tree before moving to the "Idling" tree again once the player stops. 


It didn't work, initially. I tried to update the game in the 15 minutes I had left in the lesson, and I couldn't figure out why the animations were not updating in the game. 

On Wednesday, I found the culprit. 

I had placed the code for updating the games animation in its own function, and I didn't call it.

After calling the function in Update(), the player now not only moves, but the animation changes to face the desired direction whenever the keys are pressed for that direction. 


Next, I worked on the design of the game. I added assets from kenney.nl to create this small island, using the Tile map system. I used the Isometric Landscapes pack to build ground around the player. 


I then used a combo of that pack, the Isometric Buildings and the Isometric City pack to build a much larger environment. 


I had 3 isometric Tilemaps within the grid in the game. 2 of those tile maps have Tilemap Collider 2D components, preventing the player from going into, or moving past the Tilemaps, creating a wall for the world. 


I used Unity's Tile Palette feature (Window - > 2D -> Tile Palette) to fill the game with the appropriate sprites.  

Ground layer.





Ground + Pavement layer.

Ground + Pavement + Buildings layer.



Next week, I will start to create an enemy, by making the object, and adding a AI movement script. 










No comments:

Post a Comment

My personal fashion journey... so far.

Intro.  Hello! Today I'm going to be discussing my fashion journey so far! Recently I've been getting into fashion as a personal h...