khanat-client/scenes/game/game.gd

53 lines
1.4 KiB
GDScript

extends Spatial
var player_speed = 1.0
var player_rotation_speed = 0.1
var heightmap = null
func _input( event ):
var movment = Vector3( 0.0, 0.0, 0.0 )
var rotation = Vector3( 0.0, 0.0, 0.0 )
if event.is_action( "move_forward" ):
movment.z += self.player_speed
elif event.is_action( "move_backward" ):
movment.z -= self.player_speed
elif event.is_action( "move_left" ):
movment.x += self.player_speed
elif event.is_action( "move_right" ):
movment.x -= self.player_speed
if event.is_action( "turn_left" ):
rotation.y += self.player_rotation_speed
elif event.is_action( "turn_right" ):
rotation.y -= self.player_rotation_speed
$creatures/player.turn( rotation )
$creatures/player.move( movment )
func load_player( filename ):
$creatures/player.load_creature( filename )
func _on_debug_window_time_of_day_changed(value):
$sky/viewport/sky.set_day_time_hours(( value ))
func _on_debug_window_mist_level_changed(value):
$mist_fx.get_surface_material( 0 ).set_shader_param( "mist_level", value )
func _on_debug_window_douleur_minus_pressed():
$game_ui.change_douleur( -1 )
func _on_debug_window_douleur_plus_pressed():
$game_ui.change_douleur( 1 )
func _on_debug_window_oubli_minus_pressed():
$game_ui.change_oubli( -1 )
func _on_debug_window_oubli_plus_pressed():
$game_ui.change_oubli( 1 )