• Projects
  • My First Godot Game - 2D Platformer!

(Screenshot for thumbnail purposes)

Hello everyone,

So this will be my first true game with Godot. I've always wanted to make a platformer and I've started to make some good progress in Godot in just about a week or so (when I've had free hours at home to work on it).

Here's a short video of what I've got working so far!

As you can see, the player can sometimes die while jumping on top of an enemy. I still need to modify the enemy's "death trigger" shape so that this doesn't happen.

Some of the animations are still a bit sloppy, but they are my first venture into using the AnimationPlayer node, so I'm still learning the ins-and-outs of it.

As for a story for this game, I haven't really come up with one yet. This level you see in the video is more of a proof-of-concept to myself right now, but it is the foundation upon which I will build the game. The story will be interesting, hopefully, just as soon as I can figure out one that I like!

Planned features:

  • Bonus levels
  • Skills/Experience levels
  • Player can use XP/skill points to upgrade certain aspects (jumping height, movement speed, etc.,.)
  • Different enemies require different methods to defeat them!
  • Possibly some form of boss fights, though they will be very basic (or will they?)
  • RPG-like quests/missions in some cases

This game will run on Windows, Linux, and macOS, provided I can get my old iMac back to working order!

Hopefully, I can have some form of demo out this year. I'll keep this topic updated whenever I have something nifty to show!

Excellent. Keep it up. Let us know when you've got updates!

-emo

Thanks! I made some slight improvements that are worth mentioning already.

First, using is_on_floor() was proving to be inconsistent for a lot of planned features, so I quickly replaced it by adding some raycast nodes to my player. What I didn't anticipate is that those raycasts would also interact with my coins and enemies, so anytime the player landed on them it would "ground" the player again, thus not triggering the events/animations.

I tried to solve the problem by using the collision layer/masks features, but I don't think I was using them properly as they weren't working either and causing even more strange behavior, so instead I opted to put all of my coins and enemies in a parent node and did the following in my player's ready function: EDIT: I realized this "solution" was awful, so I finally experimented with collision layers and masks more and got that working!

    # initialize player scene
    func _ready():
    	
    	# set the default direction and position
    	facing = direction.right
    	startPos = position
    	
    	# loop through the COINS and ENEMIES node to add them to the
    	# exception list for the RayCast2D nodes. Bit of a pain, but meh.
    	var coinCount = get_parent().get_node("Coins").get_child_count()
    	var enemyCount = get_parent().get_node("Enemies").get_child_count()
    	
    	# loop and add all Coins to exception list
    	for i in range(coinCount):
    		var coinName = get_parent().get_node("Coins").get_child(i)
    		$LeftFoot.add_exception(coinName)
    		$RightFoot.add_exception(coinName)
    	
    	# loop and add all Enemies to exception list
    	for i in range(enemyCount):
    		var enemyName = get_parent().get_node("Enemies").get_child(i)
    		
    		# add exceptions for BounceTrigger and Death Area2D nodes, and Body node
    		$LeftFoot.add_exception(enemyName.get_node("BounceTrigger"))
    		$LeftFoot.add_exception(enemyName.get_node("Death"))
    		$LeftFoot.add_exception(enemyName.get_node("Body"))
    		
    		$RightFoot.add_exception(enemyName.get_node("BounceTrigger"))
    		$RightFoot.add_exception(enemyName.get_node("Death"))
    		$RightFoot.add_exception(enemyName.get_node("Body"))
    	
    	# add exceptions for the player's BODY
    	$LeftFoot.add_exception($Body)
    	$RightFoot.add_exception($Body)

It's not my preferred method of doing this, but it works like a charm!

I also added more debug info and modified the shape of my enemies' death triggers so that the player can't kill and be killed at the same time. And I changed the animation of killing the enemy so that it "squishes". Needs some tweaking but it was done in less than two minutes and was just something I did for fun. :trollface:

Wow! This is really good for your first project. Great work.

@AlexandrosKap said: Wow! This is really good for your first project. Great work.

Thanks! I should clarify, this isn't exactly my first project in Godot (or ever, plenty of experience with Unity as well), but this is the first project I plan to actually see through to the end and release. :smile:

The amount of improvements in Godot 3.0.3 over anything in the 2.x branch is amazing. I can't believe how quickly I'm able to animate things and actually focus on making the game. After this, I plan to try out more of the 3D features and see if I can't make some fun stuff happen there!

I'm setting some goals to work on this weekend, which include:

  • Making item boxes
  • Begin coding the leveling/XP system
  • Come up with more baddies for the player to fight!

If I can get two out of three done, I'll be happy!

OK, here's some improvements I made!

The majority of the improvements have to do with refactoring a lot of my existing code. I had a lot of redundant checks in some places and I managed to improve some efficiency by creating functions for repetitive tasks.

I also greatly improved how the player is controlled, so it feels more like an actual platformer and not like you're struggling to control a cube with physics. :tongue:

I also created a sprite that better represents the size I want my final player object to be. Ignore the creepy face!

Here's a video showing the improvements as well as a new object!

I'm still planning on working out the xp/leveling system tomorrow. For now, I think I'm calling it a day!

Really loving the progress you've made on this so far, keep up the good work! Are you looking to create a story driven game with different worlds to explore?

@Hippo said: Really loving the progress you've made on this so far, keep up the good work! Are you looking to create a story driven game with different worlds to explore?

Thanks! And yes, I'm planning to include some story-driven gameplay. Different worlds will also be featured, though I'm not sure how I'll implement that into the story. I don't want it to really "feel" like Mario in that you have to go through a Grassy world, Desert world, Water world etc.,. I want to come up with my own unique levels and worlds, so that will be something that I think will honestly be the biggest challenge in all of this.

This reminds me: I will NOT be including ANY water levels! I hate every water level in every game I have ever played, and I've not met anyone who disagrees with me. The only way water will be included is in ice form, and decoration.

I also need to figure out how I'm going to handle puzzles. But that's something that will come down the line later!

Best of luck! I've found that art is much more time consuming and difficult to get right than the coding itself. Look forwards to seeing what unique worlds and levels you can come up with.

Yes, I think the art design is always more challenging. With coding you can typically find solutions to any errors or problems rather quickly (in most cases), so coding has never been my biggest downfall, it's usually the art/coming up with good gameplay.

But hey, I got my Xp and leveling system added, as well as a few other things... :smiley:

This is looking really great BinaryOrange!

It looks like the player has really solid controls/physics, something I know is much harder than it looks. I am really enjoying seeing the game come along.

Out of curiosity, what happens when you level up? Do you jump higher or can take more hits? I cannot think of any platformers I have seen with a level system, so I am curious (and excited) to see how you plan on making leveling up work.

Thanks! :sunglasses:

Leveling up will offer a bevy of benefits. For each level you gain, you will gain a Skill Point, and can use those Skills Points to level up certain attributes or unlock some items in the game that may just help the player along.

The best way I can describe it is very similar to Paper Mario's system - when you gain a level, you can choose to spend the points upgrading your Hit Points or Flower Points. I will have a similar system, but it will be for different attributes. I'm still figuring out how exactly it will fit into any story (which, incidentally, I have no story for the game yet! Dear me!), right now I'm just more concerned with getting the main mechanics of the game down.

I'm still not 100% satisfied with how the player controls, I feel as though the movement can be made better still.

I'm hoping to dedicate Wednesday (I have that day off of work) to implementing item boxes of some sort, and further refactoring some of the code before it turns into even more spaghetti code! It was making me hungry earlier, haha!

Great progress, I wish I had your passion for code refactoring. xD

@BinaryOrange said: The best way I can describe it is very similar to Paper Mario's system - when you gain a level, you can choose to spend the points upgrading your Hit Points or Flower Points. I will have a similar system, but it will be for different attributes.

Cool! I've played Paper Mario and I thought the leveling system was pretty cool. I am looking forward to seeing it!

I'm still figuring out how exactly it will fit into any story (which, incidentally, I have no story for the game yet! Dear me!), right now I'm just more concerned with getting the main mechanics of the game down.

I am all to familiar with this problem! This is me on almost every single game I have ever made. This probably sounds bad, but I am glad it is not just me who does this :lol:

I'm hoping to dedicate Wednesday (I have that day off of work) to implementing item boxes of some sort, and further refactoring some of the code before it turns into even more spaghetti code! It was making me hungry earlier, haha!

Good luck! I am looking forward to seeing the game progress!

OK, so I lost almost four hours today because of a crazy occurrence.

I was in the process of adding in item boxes and running my scene quick to test to make sure it would instance the item properly, and my player couldn't jump!

After tons of digging, I determined that the problem was caused by the fact that gravity was being instantly applied to the player, instead of over time.

I have no idea how this happened, but somehow my update_gravity() function (which I pass the delta variable into) not only lost the delta parameter, but also somehow removed multiplication by delta from these lines:

gravity = (GravityPull * GravityMultiplier)
velocity.y += gravity * delta

...so that it read:

velocity.y += gravity

I am not sure how that happened, as that is code I wrote all the way back in January, sooo.... anybody ever see anything like that happen before? :tongue:

ANYWAY!

Now that's out of the way, I did manage to add in item boxes, though currently the only item added is the Speed Boost, which expires after 30 seconds. Here's a video, which also shows off some other stuff!

I am realizing that my project is quickly spaghettifying, so I need to tidy it up before I go too much further. Wish me luck!

It's really frustrating when you spend multiple hours trying to track down a bug that seems to have appeared out of nowhere. Looking good though, I notice you're improving at playing your game. xD

Well, this weekend got away from me so I didn't get as much done as I would have liked, but I did make some minor improvements.

  • Made it so that tutorial signs disable input so that the player can't walk away mid-conversation, and changed the sound to something less chimey and annoying
  • Started implementing a hit point/damage system
  • Adjusted gravity and movement code so things felt "snappier"
  • Adjusted the XP system
  • Removed Herobrine

So, hopefully over the week I can make some more visual improvements. Unfortunately it seems I've hit that point in development where it's fine-tuning most of what I already made, so updates will probably slow down a bit.

I did come up with a name for the game, but I'm not revealing it yet... :trollface:

7 days later

Well, unfortunately the entire week got away from me, I worked 56 1/2 hours through yesterday, so didn't do too much either.

I experimented with ladders, then decided that they were completely unnecessary for my game as the Bouncers achieve the same goal with more fun, so I quickly abandoned the idea.

I made some slight improvements to how the enemies behave, but I think I need to start them from scratch and see if I can't design them a bit better, in terms of code. I'm thinking of ways to improve how they control and react to the player, so we'll see where I get with that.

23 days later

These last couple of weeks (entire month, really) have been killer at work and I've barely had time to work on the game, although any time I have had has been devoted to bug hunting and tidying things up.

I am hoping that this weekend I can get quite a bit done, I just implemented spikes tonight and plan to implement some more actions the player can do - hopefully I can have a video of it out soon!