Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://chrld8oybp4me"
|
||||||
|
path="res://.godot/imported/bg-1-1.png-2ae37cb3adc8a4d37de164fad8410862.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/bg-1-1.png"
|
||||||
|
dest_files=["res://.godot/imported/bg-1-1.png-2ae37cb3adc8a4d37de164fad8410862.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dhw3lpuskbvku"
|
||||||
|
path="res://.godot/imported/mario-luigi-4.png-55cb8ccf2d0ab8fc27d18218e7e67b01.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/mario-luigi-4.png"
|
||||||
|
dest_files=["res://.godot/imported/mario-luigi-4.png-55cb8ccf2d0ab8fc27d18218e7e67b01.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
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/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
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="RetroMario"
|
||||||
|
run/main_scene="res://scenes/level_1.tscn"
|
||||||
|
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/stretch/mode="viewport"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
move_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
jump={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crawl={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
textures/canvas_textures/default_texture_filter=0
|
||||||
+18926
File diff suppressed because one or more lines are too long
@@ -0,0 +1,86 @@
|
|||||||
|
[gd_scene load_steps=11 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"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_l22ll"]
|
||||||
|
atlas = ExtResource("1_w3chr")
|
||||||
|
region = Rect2(182, 34, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rku65"]
|
||||||
|
atlas = ExtResource("1_w3chr")
|
||||||
|
region = Rect2(80, 34, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dmbgr"]
|
||||||
|
atlas = ExtResource("1_w3chr")
|
||||||
|
region = Rect2(165, 34, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jb1pe"]
|
||||||
|
atlas = ExtResource("1_w3chr")
|
||||||
|
region = Rect2(97, 34, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fgp3y"]
|
||||||
|
atlas = ExtResource("1_w3chr")
|
||||||
|
region = Rect2(114, 34, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_25ryr"]
|
||||||
|
atlas = ExtResource("1_w3chr")
|
||||||
|
region = Rect2(131, 34, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_l5s58"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_l22ll")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"fall",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rku65")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dmbgr")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"jump",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_jb1pe")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_fgp3y")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_25ryr")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"run",
|
||||||
|
"speed": 10.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4sl4a"]
|
||||||
|
radius = 6.0
|
||||||
|
height = 16.0
|
||||||
|
|
||||||
|
[node name="player" type="CharacterBody2D"]
|
||||||
|
position = Vector2(0, -10)
|
||||||
|
script = ExtResource("1_lm7ix")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
position = Vector2(0, 2)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_l5s58")
|
||||||
|
animation = &"jump"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(0, 2)
|
||||||
|
shape = SubResource("CapsuleShape2D_4sl4a")
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
@onready var animated_sprite_2d = $AnimatedSprite2D
|
||||||
|
|
||||||
|
|
||||||
|
const SPEED = 130.0
|
||||||
|
const JUMP_VELOCITY = -350.0
|
||||||
|
|
||||||
|
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||||
|
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
# Add the gravity.
|
||||||
|
if not is_on_floor():
|
||||||
|
velocity.y += gravity * delta
|
||||||
|
|
||||||
|
# Handle jump.
|
||||||
|
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||||
|
velocity.y = JUMP_VELOCITY
|
||||||
|
|
||||||
|
# get input
|
||||||
|
var direction = Input.get_axis("move_left", "move_right")
|
||||||
|
|
||||||
|
# face direction
|
||||||
|
if direction < 0:
|
||||||
|
animated_sprite_2d.flip_h = true
|
||||||
|
elif direction > 0:
|
||||||
|
animated_sprite_2d.flip_h = false
|
||||||
|
|
||||||
|
# play animation
|
||||||
|
if is_on_floor():
|
||||||
|
if direction != 0:
|
||||||
|
animated_sprite_2d.play("run")
|
||||||
|
else:
|
||||||
|
animated_sprite_2d.play("idle")
|
||||||
|
else:
|
||||||
|
animated_sprite_2d.play("jump")
|
||||||
|
|
||||||
|
if direction:
|
||||||
|
velocity.x = direction * SPEED
|
||||||
|
else:
|
||||||
|
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
Reference in New Issue
Block a user