Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Tried modifying Godot 2D Tutorial game

A topic by bdirgo created Aug 23, 2020 Views: 235 Replies: 5
Viewing posts 1 to 3
Submitted

https://docs.godotengine.org/en/stable/getting_started/step_by_step/your_first_game.html

...But didn’t get much luck. I was able to swap out the assets with what I was looking for, but the way the world is set up feels hack-y. I wanted to expand the world to more then just the single screen that they use in the example. 

I’d like to use Godot. But I’m lost on how to take the example and expand upon it. I’m using the Kenny Assets pirate pack (https://kenney.nl/assets/pirate-pack) to make a top down sea fairing sort of game with islands and ships. But I can’t get the ship to move out of the 720x480 bounds that are in the dodge the creeps tutorial. Not sure where that limit is being set

(1 edit)

The limit is "being set" in the Player.gd script, on the "_ready" method:

func _ready():
    screen_size = get_viewport_rect().size

The Viewport is the screen that contains the game, so it's size is the same as the game window (sorta, mostly). That's where the 720x480 comes from.

They are then being enforced when you move the player:

position += velocity*delta
position.x = clamp(position.x, 0, screen_size.x)
position.y = clamp(position.y, 0, screen_size.y)

Looking at the documentation for "clamp" (by ctrl+clicking the function), you'll see it takes a value (position.x) and ensures it's within a set range (from 0 to either screen_size's y or x component).

Dodge the Creeps is an interesting tutorial in the sense that it's very different from the way you'll usually make beginner games in Godot (e.g.: using KinematicBody2D for the player and moving with move_and_slide), so it might not actually be the best introduction (we really could make it better for 4.0 release, that'd be cool). I'd recommend watching some tutorials from YT by such as GDQuest, KidsCanCode, Heartbeast and GameEndeavor to get the hang of it and then diving into code samples and the documentation's articles later to learn best practices and coding patterns. If you deeply dislike YT videos for some reason, then check out the KinematicBody2D, StaticBody2D and Camera2D nodes.

Edit: I've just checked out your asset pack and you'll probably need a TileMap node too.

Submitted(+1)

Excellent reply, thank you lila-k!

I tried removing those lines of code but it didn't seem to work. I am going to take your advice and look at those other tutorials instead of looking at Dodge the Creeps. 

Thank you for suggesting documentation as well, sometimes it's easier to learn from scanning text then waiting for a video to talk about a subject.

Submitted(+1)

Submitted something that works, thanks to your advice! Didn’t get as far as I wanted, but I’m pointed in the right direction now making progress everyday :-)


https://itch.io/jam/extra-credits-game-jam-6/rate/739611

ooh, I'm so glad you've found my answer to be helpful!

I also much prefer text tutorials. KidsCanCode has most of his stuff in both text and video format, and recently (like a week or two ago) GDQuest started experimenting with text content too!

I'll sure try and leave some feedback on your entry this weekend :)

I've also just sent you a friend request on Discord, so feel free to hit me up if you have some further questions. I'd be happy to help you figure out what went wrong when you tried to modify Dodge the Creeps' code, for example. :)

Submitted

Godot is a fantastic game engine, you'll only need to make a few small games to actually know what you're doing with it ! We uploaded our first 3d game made with godot today and I think it's pretty good, considering I was the sole programmer and didn't know a thing about the engine 6 months ago !

You can try it out here if you want ! :p https://itch.io/jam/extra-credits-game-jam-6/rate/736364

Good luck with your Godot journey, the engine is growing rapidly and so is its wonderful community !
GDquest makes wonderful tutorials if you are starting out and need... well basically anything :)