added more sounds and autocollect coin

This commit is contained in:
Jonas Braus
2024-07-31 19:49:20 +02:00
parent 85736f82e0
commit b18dfee7dc
10 changed files with 56 additions and 8 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../../../../home/jonas/Schreibtisch/Export_Mario_Android/retromario.apk"
export_path="../../../../../home/jonas/Schreibtisch/Export_Android/retromario.apk"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
+5
View File
@@ -70,6 +70,11 @@ flower={
pointing/emulate_touch_from_mouse=true
pointing/emulate_mouse_from_touch=false
[physics]
2d/physics_engine="GodotPhysics2D"
2d/solver/contact_max_allowed_penetration=0.01
[rendering]
textures/canvas_textures/default_texture_filter=0
+5
View File
@@ -70,4 +70,9 @@ collision_mask = 2
position = Vector2(8, 0.5)
shape = SubResource("RectangleShape2D_enc16")
[node name="Timer" type="Timer" parent="."]
wait_time = 0.3
one_shot = true
[connection signal="body_entered" from="activate" to="." method="_on_activate_body_entered"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
+6 -1
View File
@@ -1,9 +1,11 @@
[gd_scene load_steps=9 format=3 uid="uid://beaktq6mygp6c"]
[gd_scene load_steps=10 format=3 uid="uid://beaktq6mygp6c"]
[ext_resource type="Script" path="res://scripts/items/fireball.gd" id="1_c103u"]
[ext_resource type="Texture2D" uid="uid://ddl5f3lldrp2n" path="res://assets/enemies.png" id="1_sy4od"]
[ext_resource type="AudioStream" uid="uid://si212xxdt3wk" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Fire Ball.wav" id="3_270oi"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_27hkc"]
friction = 0.0
bounce = 0.7
[sub_resource type="AtlasTexture" id="AtlasTexture_pjn1s"]
@@ -57,6 +59,9 @@ collision_mask = 128
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemieDie"]
shape = SubResource("CircleShape2D_ly4gs")
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3_270oi")
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
[connection signal="body_entered" from="CollCount" to="." method="_on_area_2d_body_entered"]
[connection signal="body_entered" from="EnemieDie" to="." method="_on_enemie_die_body_entered"]
+11
View File
@@ -19078,6 +19078,7 @@ position = Vector2(1, -90)
[node name="itemblock" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(96, -48)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="destroyblock" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(160, -48)
@@ -19092,6 +19093,7 @@ position = Vector2(192, -48)
[node name="itemblock3" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(208, -48)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="destroyblock3" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(224, -48)
@@ -19099,6 +19101,7 @@ position = Vector2(224, -48)
[node name="itemblock4" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(192, -112)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="itemblock5" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1168, -48)
@@ -19146,6 +19149,7 @@ position = Vector2(1408, -112)
[node name="itemblock6" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1424, -112)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="destroyblock17" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(1424, -48)
@@ -19159,18 +19163,22 @@ position = Vector2(1536, -48)
[node name="itemblock7" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1616, -48)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="itemblock8" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1664, -48)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="itemblock9" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1712, -48)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="itemblock10" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1664, -112)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="destroyblock20" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(1792, -48)
@@ -19190,10 +19198,12 @@ position = Vector2(1952, -112)
[node name="itemblock11" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1968, -112)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="itemblock12" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1984, -112)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="destroyblock25" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(2000, -112)
@@ -19213,6 +19223,7 @@ position = Vector2(2704, -48)
[node name="itemblock13" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(2720, -48)
hit_object = ExtResource("6_evydd")
auto_collect = true
[node name="destroyblock30" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(2736, -48)
+5 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=3 uid="uid://dk1aby88pygtr"]
[gd_scene load_steps=29 format=3 uid="uid://dk1aby88pygtr"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_lm7ix"]
[ext_resource type="Texture2D" uid="uid://dhw3lpuskbvku" path="res://assets/mario-luigi-4.png" id="1_w3chr"]
@@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://d0xxlo60h1d7i" path="res://assets/coinlabel.png" id="4_o0q77"]
[ext_resource type="AudioStream" uid="uid://cbs4okawh444d" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Warp.wav" id="5_kvw73"]
[ext_resource type="AudioStream" uid="uid://bo4big602rvtr" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Jump.wav" id="6_aq3u4"]
[ext_resource type="AudioStream" uid="uid://bh8t167vl6j2n" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Kick.wav" id="8_6t158"]
[sub_resource type="AtlasTexture" id="AtlasTexture_l22ll"]
atlas = ExtResource("1_w3chr")
@@ -278,6 +279,9 @@ stream = ExtResource("5_kvw73")
[node name="JumpSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("6_aq3u4")
[node name="shrinkSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("8_6t158")
[connection signal="area_entered" from="pipedetector_ground" to="." method="_on_pipedetector_area_entered"]
[connection signal="area_exited" from="pipedetector_ground" to="." method="_on_pipedetector_area_exited"]
[connection signal="area_entered" from="pipedetector_right" to="." method="_on_pipedetector_right_area_entered"]
+12 -1
View File
@@ -1,22 +1,33 @@
extends RigidBody2D
@onready var animated_sprite_2d = $AnimatedSprite2D
@export var hit_object:PackedScene
@export var auto_collect:bool
var destroyed = false
var instance = null
var _body = null
@onready var timer = $Timer
func _ready():
animated_sprite_2d.play("idle")#
func _on_activate_body_entered(body):
_body = body
if destroyed:
return
destroyed = true
animated_sprite_2d.play("destroy")
if hit_object == null:
return
var instance = hit_object.instantiate()
instance = hit_object.instantiate()
add_child(instance)
instance.position.y -= 16
timer.start()
func _on_timer_timeout():
if auto_collect:
instance.collect_coin(_body)
+1
View File
@@ -40,6 +40,7 @@ func f_die():
speed = 0
animated_sprite_2d.play("die")
timer.start()
if die != null:
die.queue_free()
die_sound.play()
ray_cast_left_2.queue_free()
+2
View File
@@ -1,10 +1,12 @@
extends RigidBody2D
@onready var timer = $Timer
var enter_count = 0
@onready var audio_stream_player_2d = $AudioStreamPlayer2D
# Called when the node enters the scene tree for the first time.
func _ready():
timer.start()
audio_stream_player_2d.play()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
+6 -2
View File
@@ -9,6 +9,7 @@ extends CharacterBody2D
@onready var pipedetector_ground = $pipedetector_ground
@onready var pipe_sound = $PipeSound
@onready var jump_sound = $JumpSound
@onready var shrink_sound = $shrinkSound
const SPEED = 130.0
@@ -42,7 +43,8 @@ func _unhandled_input(event):
if event.position.x < get_viewport_rect().size.x / 2:
touch_anchor = event.position
else:
if event.position.y > get_viewport_rect().size.y / 2 and not jump:
if event.position.y > get_viewport_rect().size.y / 2:
if not jump:
jump = true
elif not fire:
fire = true
@@ -101,7 +103,7 @@ func _physics_process(delta):
get_parent().add_child(instance)
instance.position.x = position.x -8 if animated_sprite_2d.flip_h else position.x + 8
instance.position.y = position.y
instance.linear_velocity.x = -400 if animated_sprite_2d.flip_h else 400
instance.linear_velocity.x = -200 if animated_sprite_2d.flip_h else 200
instance.linear_velocity.y = 50
instance.angular_velocity = 0
@@ -165,10 +167,12 @@ func flower():
func shrink():
if is_flower:
is_flower = false
shrink_sound.play()
elif is_big:
is_big = false
collision_shape_2d.shape.height = 16
pipedetector_ground.position.y -= 8
shrink_sound.play()
else:
print("dead")