mirror of
https://github.com/Escada-Games/diver-down.git
synced 2026-01-23 07:39:20 +00:00
Added a spherize shader effect when emerging
This commit is contained in:
parent
2b5daaeea0
commit
49d012e8b5
3 changed files with 39 additions and 36 deletions
|
|
@ -36,36 +36,36 @@ func _ready():
|
|||
randomize()
|
||||
OS.window_size*=2
|
||||
|
||||
print('Global: Creating a Tween node...')
|
||||
print_debug('Global: Creating a Tween node...')
|
||||
var i=Tween.new()
|
||||
i.name='twn'
|
||||
add_child(i)
|
||||
twn=get_node('twn')
|
||||
print('Global: Done creating a Tween node.')
|
||||
print_debug('Global: Done creating a Tween node.')
|
||||
|
||||
print('Global: Adding the Pause Manager to childrens...')
|
||||
print_debug('Global: Adding the Pause Manager to childrens...')
|
||||
add_child(pause_manager.instance())
|
||||
print('Global: Done adding the Pause Manager.')
|
||||
print_debug('Global: Done adding the Pause Manager.')
|
||||
|
||||
print('Global: Creating a Canvas Modulate to add some blue tint to the screen...')
|
||||
print_debug('Global: Creating a Canvas Modulate to add some blue tint to the screen...')
|
||||
var j=CanvasModulate.new()
|
||||
j.name='tint'
|
||||
j.color=blue_tint
|
||||
add_child(j)
|
||||
print('Global: Done adding the Canvas Modulate.')
|
||||
print_debug('Global: Done adding the Canvas Modulate.')
|
||||
|
||||
print('Global: Turning processing on, for displaying the FPS on the window name...')
|
||||
print_debug('Global: Turning processing on, for displaying the FPS on the window name...')
|
||||
set_process(true)
|
||||
print('Global: Done turning processing on.')
|
||||
print_debug('Global: Done turning processing on.')
|
||||
|
||||
print('Global: Adding the first music...')
|
||||
print_debug('Global: Adding the first music...')
|
||||
var k=music1.instance()
|
||||
k.name='music'
|
||||
add_child(k)
|
||||
print('Global: Done! Have fun with the same chord played over and over!')
|
||||
print_debug('Global: Done! Have fun with the same chord played over and over!')
|
||||
|
||||
print('Global: Creating a Timer for the people that will speedrun this game...')
|
||||
print('Global: (I guess no one will do such thing, but... meh, whatever I guess)')
|
||||
print_debug('Global: Creating a Timer for the people that will speedrun this game...')
|
||||
print_debug('Global: (I guess no one will do such thing, but... meh, whatever I guess)')
|
||||
var l=Timer.new()
|
||||
l.name='timer'
|
||||
l.wait_time=60
|
||||
|
|
@ -73,9 +73,9 @@ func _ready():
|
|||
l.one_shot=false
|
||||
l.connect("timeout", global, 'add_to_minutes')
|
||||
add_child(l)
|
||||
print('Global: Done! Timer added.')
|
||||
print_debug('Global: Done! Timer added.')
|
||||
|
||||
print('Global: Ready! Hope you have fun!')
|
||||
print_debug('Global: Ready! Hope you have fun!')
|
||||
|
||||
func add_to_minutes(): minutes+=1
|
||||
func startTimer(): $timer.start()
|
||||
|
|
@ -118,7 +118,7 @@ func change_stage(stage):
|
|||
func reload_stage():
|
||||
if get_tree().current_scene.modulate.a==1:
|
||||
changeFromLowPassMusic()
|
||||
print('Global: Reseting current stage.')
|
||||
print_debug('Global: Reseting current stage.')
|
||||
get_tree().paused=true
|
||||
$tint.color=red_tint
|
||||
yield(get_tree().create_timer(0.75), 'timeout')
|
||||
|
|
@ -129,18 +129,18 @@ func reload_stage():
|
|||
# get_tree().reload_current_scene()
|
||||
# add_child(stage_reseter.instance())
|
||||
func changeToLowPassMusic():
|
||||
print('Global: Changing to filtered music.')
|
||||
print_debug('Global: Changing to filtered music.')
|
||||
AudioServer.set_bus_mute(AudioServer.get_bus_index('bgm'), true)
|
||||
AudioServer.set_bus_mute(AudioServer.get_bus_index('bgm_lp'), false)
|
||||
print('Global: Done, the music was changed.')
|
||||
print_debug('Global: Done, the music was changed.')
|
||||
|
||||
func changeFromLowPassMusic():
|
||||
print('Global: Changing to unfiltered music.')
|
||||
print_debug('Global: Changing to unfiltered music.')
|
||||
AudioServer.set_bus_mute(AudioServer.get_bus_index('bgm'), false)
|
||||
AudioServer.set_bus_mute(AudioServer.get_bus_index('bgm_lp'), true)
|
||||
print('Global: Done, the music was changed.')
|
||||
print_debug('Global: Done, the music was changed.')
|
||||
|
||||
func vector_lerp(begin=Vector2(), end=Vector2(), alpha=0.1):
|
||||
var x=lerp(begin.x, end.x, alpha)
|
||||
var y=lerp(begin.y, end.y, alpha)
|
||||
return Vector2(x,y)
|
||||
return Vector2(x,y)
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ const drop=preload("res://Scenes/drop.tscn")
|
|||
onready var dive_aim=$dive_aim/dive_aim
|
||||
func _ready():
|
||||
add_to_group('Player')
|
||||
global.player = id
|
||||
global.player=self
|
||||
$dive_aim.rotation=0 if self.last_horizontal_direction==1 else -PI
|
||||
|
||||
func _physics_process(delta):
|
||||
$sprite.flip_h=false if(last_horizontal_direction==1) else true
|
||||
if self.is_on_floor():
|
||||
anim="walk" if not abs(vectorVelocity.x)<=10 else "idle"
|
||||
anim="idle" if abs(vectorVelocity.x)<=10 else "walk"
|
||||
else:
|
||||
anim="going_up" if vectorVelocity.y<0 else "goind_down"
|
||||
if($animation_player.current_animation!=anim): $animation_player.play(anim)
|
||||
|
|
@ -77,6 +77,7 @@ func _state_normal(delta,vector_direction_input):
|
|||
|
||||
if diveBuffer>0 and dive_aim.get_overlapping_bodies().size()>0:
|
||||
var phaseable=true
|
||||
#Check if the tileset is unphaseable
|
||||
for body in dive_aim.get_overlapping_bodies():
|
||||
if body.is_in_group('Unphaseable'): phaseable=false
|
||||
if phaseable:
|
||||
|
|
@ -84,15 +85,15 @@ func _state_normal(delta,vector_direction_input):
|
|||
if randf()<=0.5: $sounds/snd_dive.play()
|
||||
else: $sounds/snd_dive1.play()
|
||||
self.state=State_dive
|
||||
var cursor_position=dive_aim.get_node('position_2d').global_position-Vector2(0,1)#dive_aim.get_node("collision_shape_2d").global_position+dive_aim.get_node("collision_shape_2d").shape.extents*Vector2(1,1)
|
||||
var cursor_position=dive_aim.get_node('position_2d').global_position-Vector2(0,1)
|
||||
var vector_target_position=Vector2(floor(cursor_position.x/global.tile_size.x)*global.tile_size.x,floor(cursor_position.y/global.tile_size.y)*global.tile_size.y)+global.tile_size/2
|
||||
$twn_dive.interpolate_property(self, 'global_position', self.global_position,vector_target_position, twn_duration, Tween.TRANS_QUART, Tween.EASE_OUT)
|
||||
$twn_dive.start()
|
||||
create_splash(20,30,-(self.global_position-vector_target_position),(self.global_position-vector_target_position)/2)
|
||||
createSpherize()
|
||||
else:
|
||||
vectorVelocity.x=lerp(vectorVelocity.x, maximum_speed*vector_direction_input.x, lerp_constant)
|
||||
var initialVelocity=vectorVelocity
|
||||
vectorVelocity.x=lerp(vectorVelocity.x, maximum_speed*vector_direction_input.x, lerp_constant)
|
||||
vectorVelocity.y+=vector_gravity.y
|
||||
vectorVelocity=move_and_slide(vectorVelocity, vector_normal)
|
||||
if initialVelocity.y!=vectorVelocity.y and self.is_on_floor():
|
||||
|
|
@ -109,6 +110,7 @@ func _state_dive(delta,vector_direction_input):
|
|||
$twn_dive.interpolate_property(self, 'global_position', self.global_position,vector_target_position, twn_duration*0.8, Tween.TRANS_QUART, Tween.EASE_OUT)
|
||||
$twn_dive.start()
|
||||
create_splash(10,15,(self.global_position-vector_target_position),(self.global_position-vector_target_position)/2)
|
||||
createSpherize()
|
||||
vectorVelocity=Vector2()#(self.global_position-vector_target_position).normalized()*maximum_speed #Add conservation of momentum maybe
|
||||
#@Maybe allow for diving without the position "fixing" //@Add a dive buffer as well
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@
|
|||
[sub_resource type="GDScript" id=1]
|
||||
resource_name = "tilemap"
|
||||
script/source = "extends TileMap
|
||||
#I don't really know how to use Godot's autotile the right away, so I'm using this code!
|
||||
var grid_size = Vector2(25,16)
|
||||
var North = 1; var West = 2; var East = 4; var South = 8
|
||||
var directions = [North, South, East, West]
|
||||
var gridSize=Vector2(25,16)
|
||||
var North=1;var West=2;var East=4;var South=8
|
||||
var directions = [North,South,East,West]
|
||||
var dictionary_paths = {
|
||||
North: Vector2(0, -1),
|
||||
South: Vector2(0, +1),
|
||||
East: Vector2(+1, 0),
|
||||
West: Vector2(-1, 0)}
|
||||
North: Vector2(0,-1),
|
||||
South: Vector2(0,1),
|
||||
East: Vector2(1,0),
|
||||
West: Vector2(-1,0)
|
||||
}
|
||||
|
||||
func _ready():
|
||||
print('Tilemap: Beginning autotile...')
|
||||
for x in range(grid_size.x - 1):
|
||||
for y in range(-1,grid_size.y - 1):
|
||||
print_debug('Tilemap: Beginning autotile...')
|
||||
for x in range(gridSize.x - 1):
|
||||
for y in range(-1,gridSize.y - 1):
|
||||
if get_cell(x,y)!=-1:
|
||||
var north_tile = 1 if get_cell(x,y-1) != -1 else 0
|
||||
var west_tile = 1 if get_cell(x-1,y) != -1 else 0
|
||||
|
|
@ -40,7 +40,8 @@ func _ready():
|
|||
if tile_index==15:
|
||||
if(randf()<0.1): tile_index+=randi()%12
|
||||
set_cell(x, y, tile_index)
|
||||
print('Tilemap: Autotiling done!')"
|
||||
print_debug('Tilemap: Autotiling done!')
|
||||
"
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue