pull/7/head
Valentin Stark 3 years ago
parent d6842dd411
commit 004e1e48ae
  1. BIN
      entities/environment/birchtree/BirchTree_1.glb
  2. 1065
      entities/environment/birchtree/BirchTree_1.glb.import
  3. BIN
      entities/environment/birchtree/Black.material
  4. BIN
      entities/environment/birchtree/DarkGreen.material
  5. BIN
      entities/environment/birchtree/Green.material
  6. BIN
      entities/environment/birchtree/White.material
  7. 14
      entities/environment/birchtree/birchtree.tscn
  8. 2
      ui/map/map.gd
  9. 2
      utils/camera/CameraController.gd
  10. 24
      world/game.gd
  11. 4
      world/game.tscn

File diff suppressed because it is too large Load Diff

@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://entities/environment/birchtree/BirchTree_1.glb" type="PackedScene" id=1]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.643397, 1, 0.536359 )
[node name="Birchtree" type="StaticBody"]
[node name="CommonTree_4" parent="." instance=ExtResource( 1 )]
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1.245, 0, 0, 0, 1, 0, 1.12837, 0 )
shape = SubResource( 1 )

@ -104,7 +104,7 @@ func _draw():
# draw_voronoi_cells_convex_hull() # draw_voronoi_cells_convex_hull()
# draw_voronoi_edges(Color("#ff0000")) # draw_voronoi_edges(Color("#ff0000"))
func _process(delta): func _process(_delta):
if Input.is_action_pressed("alt_command"): if Input.is_action_pressed("alt_command"):
var new_position = get_viewport().get_mouse_position() / scale var new_position = get_viewport().get_mouse_position() / scale
if new_position.x <= 2000 and new_position.y <= 2000: if new_position.x <= 2000 and new_position.y <= 2000:

@ -78,7 +78,7 @@ func move(_velocity : Vector2):
y_offset = result.position.y y_offset = result.position.y
else: else:
y_offset = 0 y_offset = 0
global_transform.origin.y = max(10 + y_offset * 1.3, 30) global_transform.origin.y = max(5 + y_offset * 1.3, 10)
emit_signal("camera_moved", global_transform.origin) emit_signal("camera_moved", global_transform.origin)

@ -24,6 +24,7 @@ func _ready():
noise.octaves = octaves noise.octaves = octaves
terrain = Terrain.new(width,height,spacing,true) terrain = Terrain.new(width,height,spacing,true)
init_data() init_data()
add_trees()
emit_signal("world_loaded", terrain) emit_signal("world_loaded", terrain)
func init_data(): func init_data():
@ -38,6 +39,7 @@ func init_data():
for point in terrain.get_points(): for point in terrain.get_points():
if point.get_data("water") and not point.get_data("ocean"): if point.get_data("water") and not point.get_data("ocean"):
point.set_elevation(0.1) point.set_elevation(0.1)
point.set_data("water", false)
point.set_data("coast", point_is_coast(point)) point.set_data("coast", point_is_coast(point))
if point.get_data("river"): if point.get_data("river"):
set_river_path(point) set_river_path(point)
@ -121,7 +123,7 @@ func point_find_elevation(point):
elevation = min(elevation, 1) elevation = min(elevation, 1)
elevation = round(elevation * terraces) / terraces # elevation = round(elevation * terraces) / terraces
return elevation return elevation
func point_is_water(point): func point_is_water(point):
@ -173,3 +175,23 @@ func edge_is_river(edge):
if edge.start().get_data("river") and edge.end().get_data("river"): if edge.start().get_data("river") and edge.end().get_data("river"):
return true return true
return false return false
func add_trees():
rng.randomize()
var treescene = load("res://entities/environment/birchtree/birchtree.tscn")
for point in terrain.get_points():
if not point.get_data("water"):
var num = rng.randi_range(0, 5)
if num == 1:
var tree = treescene.instance()
tree.translation = Vector3(point.point3d() * Vector3(1, 24*5, 1))
add_child(tree)
# for point in points.size():
# if points_data[i].elevation > 0:
# var num = rng.randi_range(0, 20)
# if num == 2:
# var tree = treescene.instance()
# tree.translation = Vector3(points[i].x, points_data[i].elevation * terrace_height, points[i].y)
# add_child(tree)

@ -38,14 +38,16 @@ environment = ExtResource( 3 )
[node name="CamBase" parent="World" instance=ExtResource( 5 )] [node name="CamBase" parent="World" instance=ExtResource( 5 )]
[node name="Camera" parent="World/CamBase" index="0"] [node name="Camera" parent="World/CamBase" index="0"]
transform = Transform( 1, 0, 0, 0, 0.910272, -0.41401, 0, 0.41401, 0.910272, 0, -1.90735e-06, 6.618 )
movement_speed = 48.076 movement_speed = 48.076
min_zoom = 10.0 min_zoom = 10.0
zoom_sensibility = 1.436 zoom_sensibility = 1.436
rotation_sensibility = 3.0 rotation_sensibility = 3.0
[node name="DirectionalLight" type="DirectionalLight" parent="World"] [node name="DirectionalLight" type="DirectionalLight" parent="World"]
transform = Transform( 1, 0, 0, 0, 0.41636, 0.9092, 0, -0.9092, 0.41636, 0, 1.41623, 0 ) transform = Transform( 1, 0, 0, 0, 0.512597, 0.858629, 0, -0.858629, 0.512597, 0, 1.41623, 0 )
light_energy = 0.1 light_energy = 0.1
shadow_enabled = true
[connection signal="world_loaded" from="." to="UI/Map" method="_on_Game_world_loaded"] [connection signal="world_loaded" from="." to="UI/Map" method="_on_Game_world_loaded"]
[connection signal="world_loaded" from="." to="World" method="_on_Game_world_loaded"] [connection signal="world_loaded" from="." to="World" method="_on_Game_world_loaded"]

Loading…
Cancel
Save