diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4709183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4+ specific ignores +.godot/ diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..380de2f --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cvb07jl0jedyr" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/player.gd b/player.gd new file mode 100644 index 0000000..433e465 --- /dev/null +++ b/player.gd @@ -0,0 +1,44 @@ +extends CharacterBody2D + + +const SPEED = 300.0 +const JUMP_VELOCITY = -300.0 + +# Get the gravity from the project settings to be synced with RigidBody nodes. +var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") +#own variables see tutorial 2 +var is_jumping = false +@onready var animated_sprite_2d = $AnimatedSprite2D + + +func _physics_process(delta): + # Add the gravity. + if not is_on_floor(): + velocity.y += gravity * delta + else: + is_jumping = false + + # Handle jump. + if Input.is_action_just_pressed("ui_accept") and is_on_floor(): + velocity.y = JUMP_VELOCITY + is_jumping = true + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + var direction = Input.get_axis("ui_left", "ui_right") + if direction: + velocity.x = direction * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + update_animation(direction) + move_and_slide() + +func update_animation(direction): + if is_jumping: + animated_sprite_2d.play("jump") + elif direction != 0: + animated_sprite_2d.flip_h = (direction < 0) + animated_sprite_2d.play("run") + else: + animated_sprite_2d.play("idle") + diff --git a/player.tscn b/player.tscn new file mode 100644 index 0000000..3840e9d --- /dev/null +++ b/player.tscn @@ -0,0 +1,70 @@ +[gd_scene load_steps=10 format=3 uid="uid://c5njgaps6d3vn"] + +[ext_resource type="Texture2D" uid="uid://bbaks8lekbw53" path="res://sprites/bazzabogan.png" id="1_6kthl"] +[ext_resource type="Script" path="res://player.gd" id="1_y8jpy"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_l3wuf"] +atlas = ExtResource("1_6kthl") +region = Rect2(0, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nm0eg"] +atlas = ExtResource("1_6kthl") +region = Rect2(128, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uadt3"] +atlas = ExtResource("1_6kthl") +region = Rect2(32, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ewher"] +atlas = ExtResource("1_6kthl") +region = Rect2(64, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gctgy"] +atlas = ExtResource("1_6kthl") +region = Rect2(96, 0, 32, 32) + +[sub_resource type="SpriteFrames" id="SpriteFrames_bl6kg"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_l3wuf") +}], +"loop": true, +"name": &"idle", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_nm0eg") +}], +"loop": true, +"name": &"jump", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_uadt3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ewher") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gctgy") +}], +"loop": true, +"name": &"run", +"speed": 12.0 +}] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vmep3"] +height = 32.0 + +[node name="player" type="CharacterBody2D"] +script = ExtResource("1_y8jpy") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +sprite_frames = SubResource("SpriteFrames_bl6kg") +animation = &"run" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CapsuleShape2D_vmep3") diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..9e333de --- /dev/null +++ b/project.godot @@ -0,0 +1,22 @@ +; 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="SuperMathio" +run/main_scene="res://world.tscn" +config/features=PackedStringArray("4.2", "GL Compatibility") +config/icon="res://icon.svg" + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +environment/defaults/default_clear_color=Color(0.560784, 0.835294, 1, 1) diff --git a/sprites/bazzabogan.png b/sprites/bazzabogan.png new file mode 100644 index 0000000..c11fd2c Binary files /dev/null and b/sprites/bazzabogan.png differ diff --git a/sprites/bazzabogan.png.import b/sprites/bazzabogan.png.import new file mode 100644 index 0000000..c6622f4 --- /dev/null +++ b/sprites/bazzabogan.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bbaks8lekbw53" +path="res://.godot/imported/bazzabogan.png-1ff0b99cc899b197e52731c5bea0564c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/bazzabogan.png" +dest_files=["res://.godot/imported/bazzabogan.png-1ff0b99cc899b197e52731c5bea0564c.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 diff --git a/sprites/block.png b/sprites/block.png new file mode 100644 index 0000000..1e99a71 Binary files /dev/null and b/sprites/block.png differ diff --git a/sprites/block.png.import b/sprites/block.png.import new file mode 100644 index 0000000..6c800b8 --- /dev/null +++ b/sprites/block.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://07it5xehcx0" +path="res://.godot/imported/block.png-5bbcdacea06057fdfa5559fd03e54f2c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/block.png" +dest_files=["res://.godot/imported/block.png-5bbcdacea06057fdfa5559fd03e54f2c.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 diff --git a/sprites/brick.png b/sprites/brick.png new file mode 100644 index 0000000..2350da3 Binary files /dev/null and b/sprites/brick.png differ diff --git a/sprites/brick.png.import b/sprites/brick.png.import new file mode 100644 index 0000000..0fef717 --- /dev/null +++ b/sprites/brick.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://wifmfna0xx26" +path="res://.godot/imported/brick.png-77d98f5d32d031ca09e379b39ddb4c05.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/brick.png" +dest_files=["res://.godot/imported/brick.png-77d98f5d32d031ca09e379b39ddb4c05.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 diff --git a/world.tscn b/world.tscn new file mode 100644 index 0000000..49f06bf --- /dev/null +++ b/world.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=7 format=3 uid="uid://d25dmlkpt468c"] + +[ext_resource type="Texture2D" uid="uid://07it5xehcx0" path="res://sprites/block.png" id="1_x4yy8"] +[ext_resource type="Texture2D" uid="uid://wifmfna0xx26" path="res://sprites/brick.png" id="2_h3orb"] +[ext_resource type="PackedScene" uid="uid://c5njgaps6d3vn" path="res://player.tscn" id="3_b84gf"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_brspi"] +resource_name = "block" +texture = ExtResource("1_x4yy8") +0:0/0 = 0 +0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:0/0/physics_layer_0/angular_velocity = 0.0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5rxdw"] +resource_name = "brick" +texture = ExtResource("2_h3orb") +0:0/0 = 0 +0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:0/0/physics_layer_0/angular_velocity = 0.0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) + +[sub_resource type="TileSet" id="TileSet_pv314"] +physics_layer_0/collision_layer = 1 +sources/0 = SubResource("TileSetAtlasSource_brspi") +sources/1 = SubResource("TileSetAtlasSource_5rxdw") + +[node name="world" type="Node2D"] + +[node name="TileMap" type="TileMap" parent="."] +tile_set = SubResource("TileSet_pv314") +format = 2 +layer_0/tile_data = PackedInt32Array(2490368, 1, 0, 2555904, 1, 0, 2621440, 1, 0, 2490369, 1, 0, 2555905, 1, 0, 2621441, 1, 0, 2490370, 1, 0, 2555906, 1, 0, 2621442, 1, 0, 2490371, 1, 0, 2555907, 1, 0, 2621443, 1, 0, 2490372, 1, 0, 2555908, 1, 0, 2621444, 1, 0, 2490373, 1, 0, 2555909, 1, 0, 2621445, 1, 0, 2490374, 1, 0, 2555910, 1, 0, 2621446, 1, 0, 2490375, 1, 0, 2555911, 1, 0, 2621447, 1, 0, 2490376, 1, 0, 2555912, 1, 0, 2621448, 1, 0, 2490377, 1, 0, 2555913, 1, 0, 2621449, 1, 0, 2490378, 1, 0, 2555914, 1, 0, 2621450, 1, 0, 2490379, 1, 0, 2555915, 1, 0, 2621451, 1, 0, 2490380, 1, 0, 2555916, 1, 0, 2621452, 1, 0, 2490381, 1, 0, 2555917, 1, 0, 2621453, 1, 0, 2490382, 1, 0, 2555918, 1, 0, 2621454, 1, 0, 2490383, 1, 0, 2555919, 1, 0, 2621455, 1, 0, 2490384, 1, 0, 2555920, 1, 0, 2621456, 1, 0, 2490385, 1, 0, 2555921, 1, 0, 2621457, 1, 0, 2490386, 1, 0, 2555922, 1, 0, 2621458, 1, 0, 2490387, 1, 0, 2555923, 1, 0, 2621459, 1, 0, 2490388, 1, 0, 2555924, 1, 0, 2621460, 1, 0, 2490389, 1, 0, 2555925, 1, 0, 2621461, 1, 0, 2490390, 1, 0, 2555926, 1, 0, 2621462, 1, 0, 2490391, 1, 0, 2555927, 1, 0, 2621463, 1, 0, 2490392, 1, 0, 2555928, 1, 0, 2621464, 1, 0, 2490393, 1, 0, 2555929, 1, 0, 2621465, 1, 0, 2490394, 1, 0, 2555930, 1, 0, 2621466, 1, 0, 2490395, 1, 0, 2555931, 1, 0, 2621467, 1, 0, 2490396, 1, 0, 2555932, 1, 0, 2621468, 1, 0, 2490397, 1, 0, 2555933, 1, 0, 2621469, 1, 0, 2490398, 1, 0, 2555934, 1, 0, 2621470, 1, 0, 2490399, 1, 0, 2555935, 1, 0, 2621471, 1, 0, 2490400, 1, 0, 2555936, 1, 0, 2621472, 1, 0, 2490401, 1, 0, 2555937, 1, 0, 2621473, 1, 0, 2490402, 1, 0, 2555938, 1, 0, 2621474, 1, 0, 2490403, 1, 0, 2555939, 1, 0, 2621475, 1, 0, 2490404, 1, 0, 2555940, 1, 0, 2621476, 1, 0, 2490405, 1, 0, 2555941, 1, 0, 2621477, 1, 0, 2490406, 1, 0, 2555942, 1, 0, 2621478, 1, 0, 2490407, 1, 0, 2555943, 1, 0, 2621479, 1, 0, 2490408, 1, 0, 2555944, 1, 0, 2621480, 1, 0, 2490409, 1, 0, 2555945, 1, 0, 2621481, 1, 0, 2490410, 1, 0, 2555946, 1, 0, 2621482, 1, 0, 2490411, 1, 0, 2555947, 1, 0, 2621483, 1, 0, 2490412, 1, 0, 2555948, 1, 0, 2621484, 1, 0, 2490413, 1, 0, 2555949, 1, 0, 2621485, 1, 0, 2490414, 1, 0, 2555950, 1, 0, 2621486, 1, 0, 2490415, 1, 0, 2555951, 1, 0, 2621487, 1, 0, 2490416, 1, 0, 2555952, 1, 0, 2621488, 1, 0, 2490417, 1, 0, 2555953, 1, 0, 2621489, 1, 0, 2490418, 1, 0, 2555954, 1, 0, 2621490, 1, 0, 2490419, 1, 0, 2555955, 1, 0, 2621491, 1, 0, 2490420, 1, 0, 2555956, 1, 0, 2621492, 1, 0, 2490421, 1, 0, 2555957, 1, 0, 2621493, 1, 0, 2490422, 1, 0, 2555958, 1, 0, 2621494, 1, 0, 2490423, 1, 0, 2555959, 1, 0, 2621495, 1, 0, 2490424, 1, 0, 2555960, 1, 0, 2621496, 1, 0, 2490425, 1, 0, 2555961, 1, 0, 2621497, 1, 0, 2490426, 1, 0, 2555962, 1, 0, 2621498, 1, 0, 2490427, 1, 0, 2555963, 1, 0, 2621499, 1, 0, 2490428, 1, 0, 2555964, 1, 0, 2621500, 1, 0, 2490429, 1, 0, 2555965, 1, 0, 2621501, 1, 0, 2490430, 1, 0, 2555966, 1, 0, 2621502, 1, 0, 2490431, 1, 0, 2555967, 1, 0, 2621503, 1, 0, 2490432, 1, 0, 2555968, 1, 0, 2621504, 1, 0, 2490433, 1, 0, 2555969, 1, 0, 2621505, 1, 0, 2490434, 1, 0, 2555970, 1, 0, 2621506, 1, 0, 2490435, 1, 0, 2555971, 1, 0, 2621507, 1, 0, 2490436, 1, 0, 2555972, 1, 0, 2621508, 1, 0, 2490437, 1, 0, 2555973, 1, 0, 2621509, 1, 0, 2490438, 1, 0, 2555974, 1, 0, 2621510, 1, 0, 2490439, 1, 0, 2555975, 1, 0, 2621511, 1, 0, 2424863, 0, 0, 2424864, 0, 0, 1966119, 1, 0, 2031655, 1, 0, 2097191, 1, 0, 2162727, 1, 0, 2228263, 1, 0, 2293799, 1, 0, 2359335, 1, 0, 2424871, 1, 0, 1966120, 1, 0, 2031656, 1, 0, 2097192, 1, 0, 2162728, 1, 0, 2228264, 1, 0, 2293800, 1, 0, 2359336, 1, 0, 2424872, 1, 0, 1966121, 1, 0, 2031657, 1, 0, 2097193, 1, 0, 2162729, 1, 0, 2228265, 1, 0, 2293801, 1, 0, 2359337, 1, 0, 2424873, 1, 0) + +[node name="player" parent="TileMap" instance=ExtResource("3_b84gf")] +position = Vector2(67, 521) + +[node name="Camera2D" type="Camera2D" parent="TileMap/player"] +limit_left = 0 +limit_top = 0 +limit_bottom = 650