Stub work for bodyparts
This commit is contained in:
parent
1fbd1149ee
commit
e977769912
5 changed files with 32 additions and 4 deletions
8
Actors/Objects/Item/Item.tscn
Normal file
8
Actors/Objects/Item/Item.tscn
Normal 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 )
|
|
@ -1,5 +1,8 @@
|
||||||
extends Node2D
|
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
|
||||||
|
|
|
@ -24,6 +24,8 @@ onready var netgame = $"/root/Multiplayer"
|
||||||
|
|
||||||
export var is_controlled = false setget set_is_controlled
|
export var is_controlled = false setget set_is_controlled
|
||||||
|
|
||||||
|
var object_name setget ,get_name
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
$Camera.current = is_controlled
|
$Camera.current = is_controlled
|
||||||
|
|
||||||
|
@ -103,3 +105,18 @@ func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
|
||||||
|
|
||||||
func get_info():
|
func get_info():
|
||||||
return netgame.player_info[get_network_master()]
|
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"
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ extents = Vector2( 32, 32 )
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody2D"]
|
[node name="Player" type="KinematicBody2D"]
|
||||||
z_index = 10
|
z_index = 10
|
||||||
collision_layer = 8
|
collision_layer = 10
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="Camera" type="Camera2D" parent="."]
|
[node name="Camera" type="Camera2D" parent="."]
|
||||||
|
|
|
@ -26,7 +26,7 @@ func _input(ev: InputEvent):
|
||||||
map_node.position = view_origin - (mouse_origin - ev.global_position)
|
map_node.position = view_origin - (mouse_origin - ev.global_position)
|
||||||
else:
|
else:
|
||||||
# Map cursor location to grid
|
# 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:
|
if ev is InputEventMouseButton:
|
||||||
|
|
Reference in a new issue