• entries
5
4
• views
424

# Dev Log #4

841 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
{
// Use this for initialization
void Start ()
{
}

{
StartCoroutine(WaitAndSetState());
}

IEnumerator WaitAndSetState()
{
yield return new WaitForSeconds(0.1f);
}
}

public class UILoading : MonoBehaviour
{
// Use this for initialization
void Start ()
{
}
}

## 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.

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!

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.

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

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.