pirate gives coin
This commit is contained in:
parent
7688cdabd2
commit
870d715fc8
BIN
Characters/Ships/ships.png
Normal file
BIN
Characters/Ships/ships.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
40
Characters/Ships/ships.png.import
Normal file
40
Characters/Ships/ships.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bp6mfy35ukucr"
|
||||
path="res://.godot/imported/ships.png-9c7c78fd31d2931a8a2561ab0299c837.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Characters/Ships/ships.png"
|
||||
dest_files=["res://.godot/imported/ships.png-9c7c78fd31d2931a8a2561ab0299c837.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
16
Characters/Ships/wrecked_boat.gd
Normal file
16
Characters/Ships/wrecked_boat.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extends Sprite2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$LifetimeTimer.timeout.connect(_on_lifetime_timeout)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
scale = scale * (0.6 ** delta)
|
||||
print("scale: ", scale)
|
||||
pass
|
||||
|
||||
func _on_lifetime_timeout():
|
||||
queue_free()
|
||||
1
Characters/Ships/wrecked_boat.gd.uid
Normal file
1
Characters/Ships/wrecked_boat.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://iak8rrn3ukxh
|
||||
16
Characters/Ships/wrecked_boat.tscn
Normal file
16
Characters/Ships/wrecked_boat.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dmpu56mdni0gp"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bp6mfy35ukucr" path="res://Characters/Ships/ships.png" id="1_i22sv"]
|
||||
[ext_resource type="Script" uid="uid://iak8rrn3ukxh" path="res://Characters/Ships/wrecked_boat.gd" id="2_6g26j"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6g26j"]
|
||||
atlas = ExtResource("1_i22sv")
|
||||
region = Rect2(132, 226, 66, 113)
|
||||
|
||||
[node name="WreckedBoat" type="Sprite2D"]
|
||||
texture = SubResource("AtlasTexture_6g26j")
|
||||
script = ExtResource("2_6g26j")
|
||||
|
||||
[node name="LifetimeTimer" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
autostart = true
|
||||
|
|
@ -7,6 +7,9 @@ extends RigidBody2D
|
|||
@export var bullet_scene: PackedScene # Scène de la balle (à assigner dans l'inspecteur)
|
||||
@export var shoot_angle_variation: float = 15.0 # Variation en degrés
|
||||
|
||||
@export var wrecked_boat_scene: PackedScene
|
||||
@export var coin_scene: PackedScene
|
||||
|
||||
@onready var shoot_timer = $ShootTimer
|
||||
@onready var player = null # Référence au joueur, à assigner via code ou groupe
|
||||
|
||||
|
|
@ -51,4 +54,13 @@ func deg_to_rad(degrees: float) -> float:
|
|||
return degrees * PI / 180.0
|
||||
|
||||
func take_damage(_damage : float):
|
||||
var wrecked_boat = wrecked_boat_scene.instantiate()
|
||||
wrecked_boat.position = position
|
||||
wrecked_boat.rotation = rotation
|
||||
get_parent().add_child(wrecked_boat)
|
||||
|
||||
var coin = coin_scene.instantiate()
|
||||
coin.position = position
|
||||
get_parent().add_child(coin)
|
||||
|
||||
queue_free()
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://mh40qx1bhgs5"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://mh40qx1bhgs5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dtxvik61iarsj" path="res://Characters/pirate.gd" id="1_afkof"]
|
||||
[ext_resource type="Texture2D" uid="uid://dani7ta4kpqva" path="res://Characters/Ships/pirate_ships.png" id="1_u2x3i"]
|
||||
[ext_resource type="PackedScene" uid="uid://ngrscx1l0dn5" path="res://GPE/CannonBall/cannon_ball.tscn" id="2_gsuw1"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu2uf2i2gaybu" path="res://Characters/Ships/cannonLoose.png" id="2_h5orw"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmpu56mdni0gp" path="res://Characters/Ships/wrecked_boat.tscn" id="3_d42on"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8ek4me3t12pp" path="res://GPE/Coin/coin.tscn" id="4_dbpq4"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_h5orw"]
|
||||
radius = 39.0
|
||||
|
|
@ -14,6 +16,8 @@ gravity_scale = 0.0
|
|||
linear_damp = 0.5
|
||||
script = ExtResource("1_afkof")
|
||||
bullet_scene = ExtResource("2_gsuw1")
|
||||
wrecked_boat_scene = ExtResource("3_d42on")
|
||||
coin_scene = ExtResource("4_dbpq4")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
rotation = -1.5707964
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=5 format=4 uid="uid://dpy36duig8jgh"]
|
||||
[gd_scene load_steps=6 format=4 uid="uid://dpy36duig8jgh"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ifus76ia8xws" path="res://Characters/player.tscn" id="1_jlnlo"]
|
||||
[ext_resource type="PackedScene" uid="uid://c6rnvbhbn7ida" path="res://Maps/Tiles/Tiles.tscn" id="2_7b103"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8ek4me3t12pp" path="res://GPE/Coin/coin.tscn" id="3_6hhq5"]
|
||||
[ext_resource type="PackedScene" uid="uid://mh40qx1bhgs5" path="res://Characters/pirate.tscn" id="4_rwt5c"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmpu56mdni0gp" path="res://Characters/Ships/wrecked_boat.tscn" id="5_6pf7f"]
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
|
|
@ -31,3 +32,6 @@ position = Vector2(331, 39)
|
|||
|
||||
[node name="Pirate4" parent="." instance=ExtResource("4_rwt5c")]
|
||||
position = Vector2(-153, -73)
|
||||
|
||||
[node name="WreckedBoat" parent="." instance=ExtResource("5_6pf7f")]
|
||||
position = Vector2(357, 193)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user