Advertisement Jump to content
  • Advertisement
  • entries
    5
  • comments
    4
  • views
    425

Dev Log #4

Treader

842 views

Intro

This has been some time coming but I guess that is to be expected there wasent enough new content to merit an entire blog post till now since so far the focus has only been polishing whats already there and to be fair I have been losing a little motivation for writing blog posts at the same time I feel like having a record of my work like this is important and in all fairness is pretty cool too look back on so I will continue doing this. That said there has been a major update which is the jump animation. During the course of my integrating the jump animation I realized unity has something called Blend tree for its animation ....I had no idea something like this even existed so I ended up learning something new after all.

 

StartUp

The way my framework well works is that it changes to the state the game currently needs to be in essentially prepares the state getting everything that needs to be ready for that state and removing the things not needed for that state so I needed some way to start the first State as soon as the mainscene loads so I ended up with the StartUp class. The responsibility of this class is to change the state to the required default state as soon as the scene loads or more broadly handle startup operations.

public class StartUp : MonoBehaviour
{
    [SerializeField] SceneLoader sceneLoader;
	// Use this for initialization
	void Start ()
    {
        sceneLoader.OnSceneLoadDone += HandleSceneLoaded;	
	}

    private void HandleSceneLoaded()
    {
        StartCoroutine(WaitAndSetState());
        sceneLoader.OnSceneLoadDone -= HandleSceneLoaded;
    }

    IEnumerator WaitAndSetState()
    {
        yield return new WaitForSeconds(0.1f);
        TreaderFSM.Instance.ChangeState(States.MAIN_MENU_STATE);
    }
}

 

Loading

So initially I wanted to have a loading bar but after some debugging I find that the loading takes 1.6 seconds max and from a user perspective it takes even less. The problem I faced was how do I visually verify if my loading screen is loading correctly if the entire thing takes less time than I take to blink. So I decided to simplify my loading  screen significantly from my initial design atleast till a time where my main scene is large enough to take more time to load. And its not like I am downloading anything. 

LoadingScreen.PNG.0ce9bf77f23f12e1a95229bb08175187.PNG

UILoading

This component attached the loading UI is responsible for telling the scene loader to load the scene.

public class UILoading : MonoBehaviour
{
    [SerializeField] SceneLoader sceneLoader;
	// Use this for initialization
	void Start ()
    {
        sceneLoader.LoadMainScene();
	}
}

 

Config

Just as I did in my last game I decided to use scriptable objects to maintain my configurable data currently only for player and obstacles.

Player Config

Currently maintains jump force and  gravity modifier values.
public class PlayerConfig : ScriptableObject
{
    public float jumpForce = 20;
    public float gravityModifier = 0.5f;
}

Obstacle Config

Currently maintain the initial speed and initial position.

public class ObstacleConfig : ScriptableObject
{
    public float horizontalSpeed = 6;
    public Vector3 initialPosition;
}

 

Player Jump

Finally to the main update for this current sprint the jump animation just like last time this is more show than tell kind of situation. Just to be clear I did not create the animations I only did the integration the animations are part of the package from the asset store. 

    void DoJump()
    {
        playerData.mainAnimator.SetBool(PlayerAnimatorKeys.GROUNDED, false);
        playerData.mainAnimator.SetFloat(PlayerAnimatorKeys.JUMPSPEED, currentForce);

        currentForce -= playerData.playerConfig.gravityModifier;
        jumpVector.y = (transform.position.y + (currentForce * Time.fixedDeltaTime));
        transform.position = jumpVector;
    }

 

Upcoming

Next on my list is:

1. Pushing the character when they encounter an obstacle.

2. Build and integrate the end screen UI to tie the whole thing in a neat bow even if incomplete

3. Finally finish my second sprint.



3 Comments


Recommended Comments

I've been reading all your entries. I just do not comment really as I have no questions or anything to add. I"m just a beginner at all this. I do enjoy seeing a more experienced person going through things. I know that blogging motivation is directly proportional to how connected you feel to people reading (at least for me) ... so I thought I would drop in and say hi! 

Share this comment


Link to comment

Hi!, Thanks for dropping a note you are absolutely right in that case knowing someone is actively reading a blog you write and how connected you feel to people reading it does do wonders for motivation so I appreciate it.

Share this comment


Link to comment

Count me in the same boat, I've found these interesting even though I don't have much worthwhile to comment! :)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!