Map help for newbie

Godot Version

4.4.1

Question

First off, a little background for my question. I’ve been coding since the mid-70’s, so I’ve got plenty of coding experience, but this is the first time I’ve tried to work with game code.

Back in 1993, as a newly-hired software engineer at Secure Computing Corporation, I was introduced to the absolute joy of a multiplayer Unix game named XTank, which dominated out lunch hours.

The basic idea of the game is the frisbee game “Ultimate”, just played inside of a deathmaze with tanks that can drop James Bond-style oil slicks.

Now, I’m trying to recreate that game 32 years later.

Ultimate map:

Game in action:

So, I’ve completed the tutorial up until “Your first 2D game”, and then messed around with the examples enough that I’ve got a cute little tank that I can direct around a blank window. It’s nowhere near all the controls required, but it works as a proof-of-concept.

extends Sprite2D

var speed = 0
var speed_multiplier = 0
var angular_speed = PI
var timer
var my_delta = 0


func _input(event):
	if event is InputEventKey:
		var keycode = event.keycode

		# If the key is [0-9], then set speed accordingly
		if event.pressed and keycode >= 48 and keycode < 57:
			speed = 100 * (keycode - 48)
			return

		if Input.is_action_pressed("ui_up"):
			speed_multiplier += 0.5
			speed = speed_multiplier * 100

		if Input.is_action_pressed("ui_down"):
			speed_multiplier -= 0.5
			speed = speed_multiplier * 100

		if Input.is_action_pressed("ui_end"):
			speed = 0
		
	return


func _on_timer_timeout():
	pass


func _ready():
	pass
	# timer = get_node("Timer")
	# timer.timeout.connect(_on_timer_timeout)
	# timer.start()


func rotate_sprite():
	var direction = 0
	if Input.is_action_pressed("ui_left"):
		direction = -1
	if Input.is_action_pressed("ui_right"):
		direction = 1

	rotation += angular_speed * direction * my_delta


func move_sprite():
	var velocity = Vector2.ZERO
	
	velocity = Vector2.UP.rotated(rotation) * speed * my_delta
	position += velocity


func _process(delta):
	my_delta = delta
	
	rotate_sprite()
	move_sprite()

I’d like to start working on the map for this game, but I’m wondering what my approach should be.

Does the map shown above, with its extremely thin barriers, lend itself to a typical tile-based approach?

Can I import an SVG as the beginnings of a map?

Is there something else I should try?

Any and all help is greatly appreciated.

-tjm

I would recommend you take a look at TileMapLayer. It was introduced in Godot 4 an it makes what you want to do easy to manage, once you understand it. The problem with using an svg would be implementing collisions. You can embed the collision info in the tiles, and then just build with them.

Good luck!

1 Like

Thanks! That’s the route I’ll go.

I found a tileset that looks like it’s perfect the map picture I posted:

tilemap

Thank you Kenney! :grin:

-tjm

2 Likes

Glad I could help. There’s some good tutorials out there and I recommend you check them out even if it’s not exactly what you’re looking to do. I’ve found neat features that I was able to use in new ways.

Kenney is the best! The Kenney Game Assets All-in-1 has been so useful for me in ways I didn’t expect.