Added building structure
Created harvester building added harvester particles added nearest resource func
This commit is contained in:
20
data/buildings/basic/harvester/harvester.gd
Normal file
20
data/buildings/basic/harvester/harvester.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends Building
|
||||
|
||||
const CARBON_RESOURCE = preload("res://data/game_resources/carbon/carbon_resource.tres")
|
||||
|
||||
func ready(building: BuildingBase) -> void:
|
||||
var nearest_res := Grid.get_nearest_resource(building.position, CARBON_RESOURCE)
|
||||
var _distance = building.position.distance_to(nearest_res)
|
||||
|
||||
var particles = CPUParticles2D.new()
|
||||
particles.amount = 60
|
||||
particles.spread = 8
|
||||
particles.material = ParticleProcessMaterial.new()
|
||||
particles.radial_accel_max = _distance * -2.5
|
||||
particles.radial_accel_min = _distance * -2.55
|
||||
particles.gravity = Vector2.ZERO
|
||||
particles.direction = building.position.direction_to(nearest_res)
|
||||
particles.initial_velocity_max = _distance * 2.25
|
||||
particles.initial_velocity_min = _distance * 2.2
|
||||
particles.lifetime = 1.65
|
||||
building.add_child(particles)
|
||||
18
data/buildings/basic/harvester/harvester_building.tres
Normal file
18
data/buildings/basic/harvester/harvester_building.tres
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_resource type="Resource" load_steps=5 format=3 uid="uid://d38xgwstvtcm4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_m1sbx"]
|
||||
[ext_resource type="Script" path="res://data/buildings/basic/harvester/harvester.gd" id="3_fy2m4"]
|
||||
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="3_xlnq5"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mgt0w"]
|
||||
atlas = ExtResource("1_m1sbx")
|
||||
region = Rect2(1088, 128, 64, 64)
|
||||
|
||||
[resource]
|
||||
script = ExtResource("3_fy2m4")
|
||||
atlas_texture = SubResource("AtlasTexture_mgt0w")
|
||||
name = "Harvester"
|
||||
description = "Harvests nearby resources"
|
||||
cost = {
|
||||
ExtResource("3_xlnq5"): 100
|
||||
}
|
||||
Reference in New Issue
Block a user