1
Fork 0
mirror of https://github.com/Steffo99/watermelonkeys-patched-ld51.git synced 2024-10-16 06:17:34 +00:00
This commit is contained in:
AndreaTerenz 2022-10-03 16:32:11 +02:00
parent a59ffe349f
commit f31eb7d496
21 changed files with 380 additions and 21 deletions

BIN
ASSETS/light/cartellone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/cartellone.png-c3f7dd8e0e6e53b08c7d2476d189a463.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/cartellone.png"
dest_files=[ "res://.import/cartellone.png-c3f7dd8e0e6e53b08c7d2476d189a463.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
ASSETS/light/crate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/crate.png-d9d8de6bc7bb8e635a9bd85f2dea827b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/crate.png"
dest_files=[ "res://.import/crate.png-d9d8de6bc7bb8e635a9bd85f2dea827b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
ASSETS/light/light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/light.png-01b8b916b62685165c35cf5cdd07131a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/light.png"
dest_files=[ "res://.import/light.png-01b8b916b62685165c35cf5cdd07131a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/maxi_schermo.png-699cf60773a06e1879a00cb457f37a2c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/maxi_schermo.png"
dest_files=[ "res://.import/maxi_schermo.png-699cf60773a06e1879a00cb457f37a2c.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
ASSETS/light/semaphore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/semaphore.png-b317d046b07a8c9e07aaecb3b7efe820.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/semaphore.png"
dest_files=[ "res://.import/semaphore.png-b317d046b07a8c9e07aaecb3b7efe820.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
ASSETS/light/v5pim1fb.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/v5pim1fb.bmp-1ca31c9a24ac1c6df11975b329f08201.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/v5pim1fb.bmp"
dest_files=[ "res://.import/v5pim1fb.bmp-1ca31c9a24ac1c6df11975b329f08201.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/vending_machine.png-7f375d3e2ae76394f7d18f6220f3cf8a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ASSETS/light/vending_machine.png"
dest_files=[ "res://.import/vending_machine.png-7f375d3e2ae76394f7d18f6220f3cf8a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

19
EnemyTest.tscn Normal file
View file

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://brick_tileset.tres" type="TileSet" id=1]
[ext_resource path="res://Giovanna.tscn" type="PackedScene" id=2]
[ext_resource path="res://enemies/Enemy.tscn" type="PackedScene" id=3]
[node name="Node2D" type="Node2D"]
[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource( 1 )
cell_size = Vector2( 16, 16 )
format = 1
tile_data = PoolIntArray( 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 11, 0, 0, 12, 0, 0, 13, 0, 0, 14, 0, 0, 15, 0, 0, 16, 0, 0, 17, 0, 0, 18, 0, 0, 19, 0, 0, 20, 0, 0, 21, 0, 0, 22, 0, 0, 23, 0, 0, 24, 0, 0, 25, 0, 0, 26, 0, 0, 27, 0, 0, 28, 0, 0, 29, 0, 0, 65536, 0, 0, 65565, 0, 0, 131072, 0, 0, 131101, 0, 0, 196608, 0, 0, 196637, 0, 0, 262144, 0, 0, 262173, 0, 0, 327680, 0, 0, 327698, 0, 0, 327699, 0, 0, 327700, 0, 0, 327701, 0, 0, 327702, 0, 0, 327703, 0, 0, 327704, 0, 0, 327705, 0, 0, 327706, 0, 0, 327707, 0, 0, 327708, 0, 0, 327709, 0, 0, 393216, 0, 0, 393245, 0, 0, 458752, 0, 0, 458781, 0, 0, 524288, 0, 0, 524317, 0, 0, 589824, 0, 0, 589841, 0, 0, 589842, 0, 0, 589843, 0, 0, 589844, 0, 0, 589845, 0, 0, 589846, 0, 0, 589847, 0, 0, 589848, 0, 0, 589849, 0, 0, 589853, 0, 0, 655360, 0, 0, 655377, 0, 0, 655389, 0, 0, 720896, 0, 0, 720913, 0, 0, 720925, 0, 0, 786432, 0, 0, 786436, 0, 0, 786437, 0, 0, 786438, 0, 0, 786439, 0, 0, 786440, 0, 0, 786441, 0, 0, 786442, 0, 0, 786443, 0, 0, 786444, 0, 0, 786449, 0, 0, 786461, 0, 0, 851968, 0, 0, 851972, 0, 0, 851973, 0, 0, 851974, 0, 0, 851975, 0, 0, 851976, 0, 0, 851977, 0, 0, 851978, 0, 0, 851979, 0, 0, 851980, 0, 0, 851997, 0, 0, 917504, 0, 0, 917533, 0, 0, 983040, 0, 0, 983069, 0, 0, 1048576, 0, 0, 1048577, 0, 0, 1048578, 0, 0, 1048579, 0, 0, 1048580, 0, 0, 1048581, 0, 0, 1048582, 0, 0, 1048583, 0, 0, 1048584, 0, 0, 1048585, 0, 0, 1048586, 0, 0, 1048587, 0, 0, 1048588, 0, 0, 1048589, 0, 0, 1048590, 0, 0, 1048591, 0, 0, 1048592, 0, 0, 1048593, 0, 0, 1048594, 0, 0, 1048595, 0, 0, 1048596, 0, 0, 1048597, 0, 0, 1048598, 0, 0, 1048599, 0, 0, 1048600, 0, 0, 1048601, 0, 0, 1048602, 0, 0, 1048603, 0, 0, 1048604, 0, 0, 1048605, 0, 0 )
[node name="Giovanna" parent="." instance=ExtResource( 2 )]
position = Vector2( 247, 139 )
[node name="Enemy" parent="." instance=ExtResource( 3 )]
position = Vector2( 121, 42 )

View file

@ -7,6 +7,7 @@
radius = 5.0
[node name="Giovanna" type="KinematicBody2D"]
z_index = 1
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true

File diff suppressed because one or more lines are too long

View file

@ -27,7 +27,8 @@ var velocity := Vector2.ZERO
var dir := Vector2.RIGHT
var charge_target := Vector2.ZERO
var charge_collision : KinematicCollision2D = null
var charge_done := false
var charge_blocked := false
var charge_dist_left = -1.0
var spawn_done := false
func _ready():
@ -85,9 +86,16 @@ func check_state():
if aggro_timer.time_left <= 0.0:
return STATES.CHARGE
STATES.CHARGE:
charge_done = charge_collision and charge_collision.collider == player
if charge_done:
var reached_player = (charge_collision and charge_collision.collider == player)
var close_enough = charge_dist_left <= pow(5.0, 2)
if reached_player:
return STATES.ATTACK
if close_enough or charge_blocked:
# we got to the targeted position, but
# found no Giovanna there...
return STATES.ROAM
STATES.ATTACK:
return state
if dist_to_player() > 20.0:
@ -113,7 +121,7 @@ func init_state():
aggro_timer.start()
charge_target = player.position
STATES.CHARGE:
charge_done = false
charge_collision = null
anim_sprite.offset *= 0.0
STATES.ATTACK:
## TEMP
@ -152,17 +160,21 @@ func run_state(delta):
var r = 2.0
anim_sprite.offset = Vector2(rand_range(-r, r), rand_range(-r, r))
STATES.CHARGE:
var target_dist = position.distance_squared_to(charge_target)
charge_dist_left = position.distance_squared_to(charge_target)
var target_dir = position.direction_to(charge_target)
var speed = roam_max_speed * attack_speed_mul
var fac = target_dist/pow(attack_dist, 2)
var fac = charge_dist_left/pow(attack_dist, 2)
velocity = velocity.linear_interpolate(target_dir * speed, fac)
move_and_slide(velocity)
var output_vel = move_and_slide(velocity)
if get_slide_count() > 0:
charge_collision = get_slide_collision(0)
if output_vel.length() == 0.0:
charge_blocked = true
STATES.ATTACK:
pass

View file

@ -33,7 +33,7 @@ animations = [ {
} ]
[sub_resource type="CircleShape2D" id=2]
radius = 42.0
radius = 34.0588
[sub_resource type="Gradient" id=3]

22
light.gd Normal file
View file

@ -0,0 +1,22 @@
extends Area2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
#randomize()
var light_types = $Sprite.frames.get_animation_names()
$Sprite.animation = light_types[randi() % light_types.size()]
#var x_range = Vector2(14, 737)
#var y_range = Vector2(134, 345)
#var random_x = randi() % int(x_range[1]- x_range[0]) + 1 + x_range[0]
#var random_y = randi() % int(y_range[1]-y_range[0]) + 1 + y_range[0]
#var random_pos = Vector2(random_x, random_y)
#$Sprite.position = random_pos
#$Light2D.position = random_pos

60
light.tscn Normal file
View file

@ -0,0 +1,60 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://ASSETS/light/light.png" type="Texture" id=1]
[ext_resource path="res://ASSETS/light/vending_machine.png" type="Texture" id=2]
[ext_resource path="res://ASSETS/light/maxi_schermo.png" type="Texture" id=4]
[ext_resource path="res://ASSETS/light/cartellone.png" type="Texture" id=5]
[ext_resource path="res://ASSETS/light/semaphore.png" type="Texture" id=6]
[ext_resource path="res://ASSETS/light/crate.png" type="Texture" id=7]
[ext_resource path="res://light.gd" type="Script" id=8]
[sub_resource type="CircleShape2D" id=3]
radius = 47.0
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 5 ) ],
"loop": true,
"name": "cartellone",
"speed": 5.0
}, {
"frames": [ ExtResource( 7 ) ],
"loop": true,
"name": "create",
"speed": 5.0
}, {
"frames": [ ExtResource( 4 ) ],
"loop": true,
"name": "screen",
"speed": 5.0
}, {
"frames": [ ExtResource( 6 ) ],
"loop": true,
"name": "semaphore",
"speed": 5.0
}, {
"frames": [ ExtResource( 2 ) ],
"loop": true,
"name": "vending_machine",
"speed": 5.0
} ]
[node name="light" type="Area2D"]
position = Vector2( 0, -23 )
script = ExtResource( 8 )
__meta__ = {
"_edit_horizontal_guides_": [ ]
}
[node name="Light2D" type="Light2D" parent="."]
scale = Vector2( 0.1604, 0.164063 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 3 )
[node name="Sprite" type="AnimatedSprite" parent="."]
position = Vector2( 0, -7 )
scale = Vector2( 1.0625, 1.25 )
frames = SubResource( 2 )
animation = "screen"