06 February 2021

I'm back, with a plan to produce a game in 3 hours every week

 Happy new year! It's been a little while, and there've been some changes. To keep it short: I'm back in school, I don't want to stop making games, I don't have alot of free time, and I hate the idea of having to put down a large project for extended periods. So, starting this week, I've decided to attempt to produce 1 new game in 3 hours every week until the end of my current semester. 

 

I'll be posting to my blog after each game is "finished" (running in a browser). If I fail to complete an idea in one week, I'll post anyway and then set the project aside for a month. If I ever fail to come up with a decent idea, I'll join a 1 week or less game jam for inspiration.

 

To start things off, here's a Flappy Bird clone possibly staring a character from Steven Universe:

https://dgalga.itch.io/fly-through-the-storm-wind


I intentionally decided to start with a super-simple design. The project took me about 152 minutes in total, and the majority of the code is all in the player.

 

For the uninitiated, Flappy Bird was a 2013 mobile title that blew up beyond anyone's expectations. It looks like this:


I've literally never played Flappy Bird in my life, and I was not interested in directly copying it. However, the potential of a system that can be engaging while requiring little more than button taps has started appealing to me recently, so I decided to take a shot at it.


I didn't really do anything to reference any part of the design of Flappy Bird. I opened a blank project, setup a basic player character, and tinkered until things felt "OK":

func _physics_process(delta):
    fail_check()
    #constant gravity
    if !calm:
        velocity.y += fall
    #rise when flying
        if Input.is_action_just_pressed("ui_select"):
            animplayer.play("flap")
            velocity.y = 0
            velocity.y -= rise
            velocity.x += forward
    elif calm:
        velocity.y += fall * 2
        if Input.is_action_just_pressed("ui_select"):
            animplayer.play("flap")
            velocity.y = 0
            velocity.y -= rise / 2
            velocity.x += forward / 2
In the above script, the player is always falling thanks to velocity.y += fall (down is positive on the Y axis in Godot, while up is negative, so adding to a variables y value before applying it to a character causes "falling"). Anytime the player taps the Space key on a keyboard, the player moves upwards and forwards for a very, very short duration. After a great deal of tinkering, I found that constantly falling at a rate of about 1 pixel, while possessing the ability to rise at the rate of about 50 pixels and move forward at a rate of 20 pixels, felt the best.


To make things a bit more interesting, I decided to create a "zone of calm" in my game. The idea was that the player character, who I'll henceforth refer to as Lapis, is flying through a storm. There is a calm space within the storm where there is no wind, but flying takes twice as much effort. This is what the calm variable above is referring to: an object outside of Lapis has the ability to reach into her script and set calm to true or false. While calm is true, flying is twice as hard as gravity is unchanged but Lapis' ability to rise up and move forward is divided in order to be more difficult.


The rest of the important code in my game is associated with the "wind". I wasn't sure how to create wind other than by using static blocks, and I clearly didn't leave myself alot of time to experiment, so static blocks is what I went with. Each block has the ability to reach into Lapis' script and move her in a given direction, with the larger blocks being twice as good at this:

func _on_Gust_body_entered(body):
    print("boop")
    body.velocity += dir_push * forward_push

The above function fires when the player touches "wind". dir_push is a variable that controls what direction the player is moved in, and forward_push controls the power of that change of direction.  The smaller wind gusts are set to 100 power, while the larger are set to 200. I still don't think these values feel perfect, but they do feel "good enough", so I settled.

 

On a side note: I totally forgot these objects are set to print the word "boop" on contact with the player. Oops.


That's really all the important code for my new game. Give it a shot and let me know what you think.

No comments:

Post a Comment

Piecemeal Jack - post 4 - wrap up

 I'm calling it quits on Piecemeal Jack for now. This is as far as I got: I built everything I had planned, to some extent, and the resu...