Stub work for bodyparts

This commit is contained in:
Hamcha 2020-09-11 11:30:35 +02:00
parent 1fbd1149ee
commit e977769912
Signed by: hamcha
GPG key ID: 41467804B19A3315
5 changed files with 32 additions and 4 deletions

View file

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="CircleShape2D" id=1]
[node name="Node2D" type="Area2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

View file

@ -1,5 +1,8 @@
extends Node2D
const MAX_HEALTH = 100.0
var base_hp = 100.0
var health = MAX_HEALTH
var damage = 0.0
func get_health() -> float:
return base_hp - damage

View file

@ -24,6 +24,8 @@ onready var netgame = $"/root/Multiplayer"
export var is_controlled = false setget set_is_controlled
var object_name setget ,get_name
func _ready():
$Camera.current = is_controlled
@ -103,3 +105,18 @@ func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
func get_info():
return netgame.player_info[get_network_master()]
func get_name():
var id = get_network_master()
return netgame.player_info[id].name
func inspect():
if is_network_master():
return {
"type": "Crewmember",
"description": "That's you!"
}
return {
"type": "Crewmember",
"description": "A fellow crewmember"
}

View file

@ -13,7 +13,7 @@ extents = Vector2( 32, 32 )
[node name="Player" type="KinematicBody2D"]
z_index = 10
collision_layer = 8
collision_layer = 10
script = ExtResource( 2 )
[node name="Camera" type="Camera2D" parent="."]

View file

@ -26,7 +26,7 @@ func _input(ev: InputEvent):
map_node.position = view_origin - (mouse_origin - ev.global_position)
else:
# Map cursor location to grid
var mouseOffset = ev.global_position - map_node.global_position
var mouse_offset = ev.global_position - map_node.global_position
if ev is InputEventMouseButton: