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