mirror of
https://github.com/Dariasteam/Cows-Revenge.git
synced 2026-01-23 02:15:17 +00:00
Add gamepad support
This commit is contained in:
parent
7759e399a9
commit
55453e0797
9 changed files with 20 additions and 20 deletions
|
|
@ -57,9 +57,8 @@ func on_opacity_high ():
|
|||
sprite.set_modulate(Color("00ffff"))
|
||||
|
||||
func play_damage_sound():
|
||||
var sample_list = sound.get_sample_library().get_sample_list()
|
||||
var sample_list = sound.get_sample_library().get_sample_list()
|
||||
sound.play(sample_list[rand_range(0, sample_list.size())], 0)
|
||||
print (sample_list[rand_range(0, sample_list.size())])
|
||||
|
||||
func decrease_life (value):
|
||||
play_damage_sound()
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ params/pitch_scale = 1.0
|
|||
params/attenuation/min_distance = 1.0
|
||||
params/attenuation/max_distance = 2048.0
|
||||
params/attenuation/distance_exp = 2.92817
|
||||
config/polyphony = 1
|
||||
config/polyphony = 3
|
||||
config/samples = ExtResource( 4 )
|
||||
config/pitch_random = 0.135
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func destroy():
|
|||
queue_free()
|
||||
|
||||
func _ready():
|
||||
sound.set_random_pitch_scale(0.2)
|
||||
sound.set_random_pitch_scale(0.2)
|
||||
sound.play("bullet_sound")
|
||||
t.set_wait_time(LIFE_TIME)
|
||||
t.set_one_shot(true)
|
||||
|
|
|
|||
|
|
@ -82,10 +82,10 @@ params/anim_initial_pos = 0.0
|
|||
|
||||
[node name="Sound" type="SamplePlayer2D" parent="."]
|
||||
|
||||
params/volume_db = 4.0
|
||||
params/volume_db = 6.0
|
||||
params/pitch_scale = 1.0
|
||||
params/attenuation/min_distance = 0.0
|
||||
params/attenuation/max_distance = 2048.0
|
||||
params/attenuation/max_distance = 764.0
|
||||
params/attenuation/distance_exp = 2.37841
|
||||
config/polyphony = 1
|
||||
config/samples = SubResource( 2 )
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ func look_right():
|
|||
middle.set_region_rect(Rect2(Vector2(0,0),Vector2(0,0)))
|
||||
middle.set_rot(0)
|
||||
|
||||
func enable():
|
||||
func enable():
|
||||
force_raycast_update()
|
||||
end.set_emitting(true)
|
||||
end.get_node("Area2D").enable()
|
||||
|
|
|
|||
|
|
@ -66,16 +66,17 @@ func shoot_regular():
|
|||
player.decrease_milk(1)
|
||||
|
||||
func shoot_laser():
|
||||
player.decrease_milk(0.05)
|
||||
player.decrease_milk(0.1)
|
||||
|
||||
func _process(delta):
|
||||
if (check_can_shoot()):
|
||||
if (weapon == WEAPONS.regular and !recharge):
|
||||
shoot_regular()
|
||||
elif (weapon == WEAPONS.laser and !shooting):
|
||||
instanced_ray.enable()
|
||||
elif (weapon == WEAPONS.laser):
|
||||
shoot_laser()
|
||||
shooting = true
|
||||
if (!shooting):
|
||||
shooting = true
|
||||
instanced_ray.enable()
|
||||
else:
|
||||
shooting = false
|
||||
instanced_ray.disable()
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ collision/bounce = 0.0
|
|||
collision/layers = 0
|
||||
collision/mask = 0
|
||||
occluder/light_mask = 1
|
||||
tile_data = IntArray( -2031646, 40, -1900576, 46, -1900574, 40, -1900573, 41, -1900572, 41, -1048607, 39, -1048598, 46, -917481, 40 )
|
||||
tile_data = IntArray( -2031646, 40, -1900576, 46, -1900574, 40, -1900573, 41, -1900572, 41, -1048609, 41, -1048608, 39, -1048607, 39, -1048598, 46, -917481, 40 )
|
||||
|
||||
[node name="tile_leaves_background" type="TileMap" parent="."]
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ collision/bounce = 0.0
|
|||
collision/layers = 0
|
||||
collision/mask = 0
|
||||
occluder/light_mask = 1
|
||||
tile_data = IntArray( -2031646, 41, -1900576, 41, -1900574, 42, -1900573, 44, -1900572, 45, -1048607, 41, -917481, 41 )
|
||||
tile_data = IntArray( -2031646, 41, -1900576, 41, -1900574, 42, -1900573, 44, -1900572, 45, -1638433, 26, -1048609, 42, -1048608, 43, -1048607, 45, -917481, 41 )
|
||||
|
||||
[node name="tile_decorations_base" type="TileMap" parent="."]
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ collision/bounce = 0.0
|
|||
collision/layers = 0
|
||||
collision/mask = 0
|
||||
occluder/light_mask = 1
|
||||
tile_data = IntArray( -2162663, 21, -2162662, 21, -2162661, 21, -2162660, 21, -2162659, 21, -2162658, 21, -2162657, 21, -2162656, 21, -2162655, 21, -2031638, 26, -1769503, 28, -1769501, 23, -1769500, 24, -1769495, 19, -1638433, 26, -1638405, 19, -1703909, 26, -1572882, 26, -1638369, 26, -1507361, 26, -1507291, 23, -1507290, 22, -1507289, 22, -1507288, 22, -1507287, 24, -1441770, 21, -1441769, 25, -983062, 28, -1048527, 26, -917536, 28, -917535, 23, -917534, 22, -917533, 24, -917516, 23, -786410, 28, -786408, 28, -786406, 28, -786404, 28, -720888, 26, -720879, 26, -524305, 19, -524293, 28, -524292, 25, -524284, 23, -524283, 22, -524282, 22, -524281, 24, -524280, 19, -458737, 23, -458736, 22, -458735, 22, -458734, 22, -458733, 22, -458732, 24, -458726, 19, -458724, 28, -458722, 28, -393179, 23, -393178, 22, -393177, 22, -393176, 22, -393175, 24, -196631, 23, -196630, 22, -196629, 24 )
|
||||
tile_data = IntArray( -2162663, 21, -2162662, 21, -2162661, 21, -2162660, 21, -2162659, 21, -2162658, 21, -2162657, 21, -2162656, 21, -2162655, 21, -2031638, 26, -1769503, 28, -1769501, 23, -1769500, 24, -1769495, 19, -1703969, 18, -1638433, 19, -1638405, 19, -1703909, 26, -1572882, 26, -1638369, 26, -1507361, 26, -1507291, 23, -1507290, 22, -1507289, 22, -1507288, 22, -1507287, 24, -1441770, 21, -1441769, 25, -983062, 28, -1048527, 26, -917536, 28, -917535, 23, -917534, 22, -917533, 24, -917516, 23, -786410, 28, -786408, 28, -786406, 28, -786404, 28, -720888, 26, -720879, 26, -524305, 19, -524293, 28, -524292, 25, -524284, 23, -524283, 22, -524282, 22, -524281, 24, -524280, 19, -458737, 23, -458736, 22, -458735, 22, -458734, 22, -458733, 22, -458732, 24, -458726, 19, -458724, 28, -458722, 28, -393179, 23, -393178, 22, -393177, 22, -393176, 22, -393175, 24, -196631, 23, -196630, 22, -196629, 24 )
|
||||
|
||||
[node name="tile_one_way_platforms" type="TileMap" parent="."]
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ collision/bounce = 0.0
|
|||
collision/layers = 2048
|
||||
collision/mask = 14
|
||||
occluder/light_mask = 1
|
||||
tile_data = IntArray( -2490339, 32, -2424804, 32, -2424803, 31, -2424802, 32, -2359269, 32, -2359268, 31, -2359267, 31, -2359266, 31, -2359265, 32, -2293734, 32, -2293733, 31, -2293732, 31, -2293731, 31, -2293730, 31, -2293729, 31, -2293728, 32, -2228199, 29, -2228198, 30, -2228197, 30, -2228196, 30, -2228195, 30, -2228194, 30, -2228193, 30, -2228192, 30, -2228191, 29, -2031647, 38, -2031646, 37, -2031645, 35, -1900577, 36, -1900576, 37, -1900575, 38, -1900574, 37, -1900573, 37, -1900572, 37, -1900571, 35, -1048608, 33, -1048607, 37, -1048606, 35, -917481, 37, -917480, 35 )
|
||||
tile_data = IntArray( -2490339, 32, -2424804, 32, -2424803, 31, -2424802, 32, -2359269, 32, -2359268, 31, -2359267, 31, -2359266, 31, -2359265, 32, -2293734, 32, -2293733, 31, -2293732, 31, -2293731, 31, -2293730, 31, -2293729, 31, -2293728, 32, -2228199, 29, -2228198, 30, -2228197, 30, -2228196, 30, -2228195, 30, -2228194, 30, -2228193, 30, -2228192, 30, -2228191, 29, -2031647, 38, -2031646, 37, -2031645, 35, -1900577, 36, -1900576, 37, -1900575, 38, -1900574, 37, -1900573, 37, -1900572, 37, -1900571, 35, -1048610, 36, -1048609, 37, -1048608, 38, -1048607, 37, -1048606, 35, -917481, 37, -917480, 35 )
|
||||
|
||||
[node name="tile_trees" type="TileMap" parent="."]
|
||||
|
||||
|
|
|
|||
Binary file not shown.
10
engine.cfg
10
engine.cfg
|
|
@ -38,11 +38,11 @@ gen_mipmaps=false
|
|||
|
||||
[input]
|
||||
|
||||
ui_left=[key(Left)]
|
||||
ui_right=[key(Right)]
|
||||
ui_change_weapon=[key(R)]
|
||||
ui_jump=[key(A), key(Space), jbutton(0, 2)]
|
||||
ui_shoot=[key(S), jbutton(0, 3)]
|
||||
ui_left=[key(Left), jbutton(0, 14)]
|
||||
ui_right=[key(Right), jbutton(0, 15)]
|
||||
ui_jump=[key(A), key(Space), jbutton(0, 1)]
|
||||
ui_change_weapon=[key(R), jbutton(0, 6)]
|
||||
ui_shoot=[key(S), jbutton(0, 0)]
|
||||
|
||||
[physics]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue