Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(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.

(+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.

(+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. :)