![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | lukasschr |
Hello everyone,
First of all I wanted to say, that I am very new to Godot and game development itself. I am familiar with Python, so I thought Godot (with GDScript) might be a good place to start.
I want to develop a 3d board game (something like monopoly). I have already created an example of the game board as a 3d grid map. I also created an player as a kinematic body and a button on the left side on the screen.
Now, when the button is pressed a random number from 1 to 6 is determined, like like a die roll. The number rolled is passed to the player script. The game board is saved as a global variable during initialization (autostart variables). The player has access to the number rolled, as well as to the entire game board and where the playing fields are located.
Now to my real question: How can I move the player to the field that was rolled? What are my options, especially if I want to add animations later? How do I check whether the player has to change direction because the playing field does not continue in that direction? (see Monopoly)
I hope the picture and the code snippet help you all to understand what I mean:
link to google drive image
extends KinematicBody
# PLAYER
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export (int) var speed = 200
var destination = Vector3.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
pass # need some help right here i think
# The function is called as soon as the result of the die roll is known.
func _on_diceroll(result):
destination = global.BOARD[result]
Sorry for my english, its not my main language.
I would appreciate any help. Thanks in advance