End of chapter 6. A lot of problems took to much time to solve. It was good to know better Godot internal mechanism.
This commit is contained in:
22
scripts/game/commands/MoveCommand.gd
Normal file
22
scripts/game/commands/MoveCommand.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
extends Command
|
||||
|
||||
class_name MoveCommand
|
||||
|
||||
var direction
|
||||
|
||||
func _init(dir):
|
||||
commandLabel = "Move"
|
||||
direction = dir
|
||||
|
||||
|
||||
func execute():
|
||||
CommandDispatcher.PLAYER_MOVE.emit(direction)
|
||||
emit_signal("COMMAND_PROCESSED", getCommandText())
|
||||
|
||||
|
||||
func getDirectionString() -> String:
|
||||
return Map.Direction.keys()[direction]
|
||||
|
||||
|
||||
func getCommandText():
|
||||
return "%s %s" % [commandLabel, getDirectionString()]
|
||||
Reference in New Issue
Block a user