Fix starting positions for characters, add some groups, add enermies to battlescene

This commit is contained in:
CactiChameleon9 2022-07-17 17:37:01 +01:00
parent d0e99788fb
commit 3ad8e574dd
6 changed files with 22 additions and 8 deletions

View File

@ -2,10 +2,9 @@ extends Node2D
export var map_position : Vector2 = Vector2.ZERO
var target_position : Vector2 = Vector2.ZERO
onready var target_position : Vector2 = position
var moving : bool = false
func _physics_process(delta):
# If the 2 positions are close enough, then not moving

View File

@ -3,7 +3,7 @@
[ext_resource path="res://icon.png" type="Texture" id=1]
[ext_resource path="res://Characters/Enemy.gd" type="Script" id=2]
[node name="Enemy" type="Node2D" groups=["Enemy"]]
[node name="Enemy" type="Node2D" groups=["Enemy", "OnMap"]]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]

View File

@ -2,10 +2,9 @@ extends Node2D
export var map_position : Vector2 = Vector2.ZERO
var target_position : Vector2 = Vector2.ZERO
onready var target_position : Vector2 = position
var moving : bool = false
func _physics_process(delta):
# If the 2 positions are close enough, then not moving

View File

@ -6,5 +6,5 @@
[node name="Player" type="Node2D"]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
[node name="Sprite" type="Sprite" parent="." groups=["OnMap"]]
texture = ExtResource( 1 )

View File

@ -20,6 +20,12 @@ func _ready():
$UI/DiceView.roll_dice()
$UI/DiceView.roll_dice()
$UI/DiceView.roll_dice()
# generate all of the OnTile nodes's tile positions
for child in get_children():
if child.is_in_group("OnMap"):
child.map_position = $TileMap.world_to_map(child.position)
func do_damage_around_player(damage, damage_range):

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://icon.png" type="Texture" id=1]
[ext_resource path="res://Characters/Player.tscn" type="PackedScene" id=2]
@ -6,6 +6,7 @@
[ext_resource path="res://UI/CardView.tscn" type="PackedScene" id=4]
[ext_resource path="res://UI/DiceView.tscn" type="PackedScene" id=5]
[ext_resource path="res://Assets/TestTile.png" type="Texture" id=6]
[ext_resource path="res://Characters/Enemy.tscn" type="PackedScene" id=7]
[sub_resource type="TileSet" id=1]
0/name = "icon.png 0"
@ -50,9 +51,9 @@ format = 1
tile_data = PoolIntArray( 65538, 1, 0, 65539, 1, 0, 65540, 1, 0, 65541, 1, 0, 131074, 1, 0, 131075, 1, 0, 131076, 1, 0, 131077, 1, 0, 131078, 0, 0, 196610, 1, 0, 196611, 1, 0, 196612, 1, 0, 196613, 1, 0, 196614, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 1, 0, 262147, 1, 0, 262148, 1, 0, 262149, 0, 0, 262150, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 393217, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 524291, 0, 0, 524292, 0, 0 )
[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( 195, 283 )
[node name="Camera2D" type="Camera2D" parent="Player"]
visible = false
offset = Vector2( 0, 200 )
current = true
drag_margin_h_enabled = true
@ -61,6 +62,15 @@ drag_margin_left = 0.3
drag_margin_top = 0.05
drag_margin_right = 0.3
[node name="Enemy" parent="." instance=ExtResource( 7 )]
position = Vector2( 565, 218 )
[node name="Enemy2" parent="." instance=ExtResource( 7 )]
position = Vector2( 916, 218 )
[node name="Enemy3" parent="." instance=ExtResource( 7 )]
position = Vector2( 1140, 630 )
[node name="UI" type="CanvasLayer" parent="."]
[node name="CardView" parent="UI" instance=ExtResource( 4 )]