summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Assets/kenney_pixelplatformer/Characters/character_0015.png.import2
-rw-r--r--Assets/kenney_pixelplatformer/Characters/character_0016.png.import2
-rw-r--r--GlobalData.gd2
-rw-r--r--Level.tscn21
-rw-r--r--PatrolEnemy.gd20
-rw-r--r--PatrolEnemy.tscn33
-rw-r--r--Player.gd8
-rw-r--r--Player.tscn2
-rw-r--r--export_presets.cfg108
10 files changed, 183 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 2578b77..2dc65e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ build/
lib/
.DS_Store
+Export/
diff --git a/Assets/kenney_pixelplatformer/Characters/character_0015.png.import b/Assets/kenney_pixelplatformer/Characters/character_0015.png.import
index bd4b9e1..e79ce67 100644
--- a/Assets/kenney_pixelplatformer/Characters/character_0015.png.import
+++ b/Assets/kenney_pixelplatformer/Characters/character_0015.png.import
@@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
-flags/filter=true
+flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
diff --git a/Assets/kenney_pixelplatformer/Characters/character_0016.png.import b/Assets/kenney_pixelplatformer/Characters/character_0016.png.import
index 7c8a92c..f25f9cb 100644
--- a/Assets/kenney_pixelplatformer/Characters/character_0016.png.import
+++ b/Assets/kenney_pixelplatformer/Characters/character_0016.png.import
@@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
-flags/filter=true
+flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
diff --git a/GlobalData.gd b/GlobalData.gd
index ae803e4..1ee67a1 100644
--- a/GlobalData.gd
+++ b/GlobalData.gd
@@ -1,6 +1,8 @@
extends Node
export(int) var player_hp = 3
+export(float) var GRAVITY: float = 1200
+export(float) var MAX_FALL_SPEED: float = 1200
# Called when the node enters the scene tree for the first time.
func _ready():
diff --git a/Level.tscn b/Level.tscn
index f3d5525..b4a9b7a 100644
--- a/Level.tscn
+++ b/Level.tscn
@@ -1,8 +1,10 @@
-[gd_scene load_steps=27 format=2]
+[gd_scene load_steps=29 format=2]
[ext_resource path="res://Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/kenney_pixelplatformer/Tilemap/tiles_packed.png" type="Texture" id=2]
[ext_resource path="res://Assets/background_glacial_mountains.png" type="Texture" id=3]
+[ext_resource path="res://PatrolEnemy.tscn" type="PackedScene" id=4]
+[ext_resource path="res://SimplePlatform.tscn" type="PackedScene" id=5]
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 0, 0, 18, 0, 18, 18, 0, 18 )
@@ -245,19 +247,17 @@ points = PoolVector2Array( 0, 0, 18, 0, 18, 18, 0, 18 )
[node name="Level" type="Node2D"]
[node name="Player" parent="." instance=ExtResource( 1 )]
-position = Vector2( 90, 54 )
+position = Vector2( 74, 54 )
scale = Vector2( 1, 1 )
-GRAVITY = 1200.0
JUMP_FORCE = 600.0
-MAX_FALL_SPEED = 1200.0
-COYOTE_TIME = 200.0
+COYOTE_TIME = 120.0
[node name="ParallaxBackground" type="ParallaxBackground" parent="Player"]
offset = Vector2( 0, -450 )
transform = Transform2D( 1, 0, 0, 1, 0, -450 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="Player/ParallaxBackground"]
-motion_scale = Vector2( 0.5, 0.1 )
+motion_scale = Vector2( 0.1, 0.05 )
motion_mirroring = Vector2( 1536, 0 )
[node name="Sprite" type="Sprite" parent="Player/ParallaxBackground/ParallaxLayer"]
@@ -271,7 +271,7 @@ current = true
limit_left = 0
limit_top = -100000000
smoothing_enabled = true
-smoothing_speed = 10.0
+smoothing_speed = 8.0
[node name="AutoTileMap" type="TileMap" parent="."]
position = Vector2( 3, -2 )
@@ -288,3 +288,10 @@ tile_set = SubResource( 23 )
cell_size = Vector2( 18, 18 )
format = 1
tile_data = PoolIntArray( -196575, -536870912, 131091, -196574, 1073741824, 131090, -196573, 1073741824, 131091, -131039, 536870912, 131091, -131038, 536870912, 262161, -131037, -2147483648, 131091, -65502, 536870912, 262160, 33, 1073741824, 262162, 34, 1610612736, 327697, 35, 1073741824, 262163, 36, 1610612736, 262162, 65570, 0, 327696, 131075, 0, 262149 )
+
+[node name="PatrolEnemy" parent="." instance=ExtResource( 4 )]
+position = Vector2( 702, 450 )
+
+[node name="SimplePlatform" parent="." instance=ExtResource( 5 )]
+position = Vector2( 910, 490 )
+rotation = -0.555015
diff --git a/PatrolEnemy.gd b/PatrolEnemy.gd
new file mode 100644
index 0000000..b3d02e2
--- /dev/null
+++ b/PatrolEnemy.gd
@@ -0,0 +1,20 @@
+extends KinematicBody2D
+
+export(float) var WALK_SPEED: float = 100
+
+var velocity: Vector2 = WALK_SPEED * Vector2.LEFT
+
+# Called when the node enters the scene tree for the first time.
+func _ready():
+ pass # Replace with function body.
+
+func _physics_process(delta):
+ velocity.y += delta * GlobalData.GRAVITY
+
+ if $RayCastWall.is_colliding():
+ scale.x = -scale.x
+ velocity.x = -velocity.x
+ print(scale, velocity)
+
+ velocity.y = clamp(velocity.y, -INF, GlobalData.MAX_FALL_SPEED)
+ move_and_slide(velocity, Vector2.UP)
diff --git a/PatrolEnemy.tscn b/PatrolEnemy.tscn
new file mode 100644
index 0000000..57ed3fa
--- /dev/null
+++ b/PatrolEnemy.tscn
@@ -0,0 +1,33 @@
+[gd_scene load_steps=6 format=2]
+
+[ext_resource path="res://PatrolEnemy.gd" type="Script" id=1]
+[ext_resource path="res://Assets/kenney_pixelplatformer/Characters/character_0016.png" type="Texture" id=2]
+[ext_resource path="res://Assets/kenney_pixelplatformer/Characters/character_0015.png" type="Texture" id=3]
+
+[sub_resource type="SpriteFrames" id=1]
+animations = [ {
+"frames": [ ExtResource( 3 ), ExtResource( 2 ) ],
+"loop": true,
+"name": "default",
+"speed": 5.0
+} ]
+
+[sub_resource type="RectangleShape2D" id=2]
+extents = Vector2( 11, 11 )
+
+[node name="PatrolEnemy" type="KinematicBody2D"]
+script = ExtResource( 1 )
+
+[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
+scale = Vector2( 2, 2 )
+frames = SubResource( 1 )
+playing = true
+
+[node name="RayCastWall" type="RayCast2D" parent="."]
+position = Vector2( 0, 23 )
+enabled = true
+cast_to = Vector2( -17, 0 )
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+position = Vector2( -1, 12 )
+shape = SubResource( 2 )
diff --git a/Player.gd b/Player.gd
index 795faf3..48c5e09 100644
--- a/Player.gd
+++ b/Player.gd
@@ -5,9 +5,7 @@ class_name Player
export(float) var WALK_ANIM_MULTIPLIER: float = 0.02
export(float) var WALK_SPEED: float = 300
export(float) var WALK_SPEED_LERP_W: float = 0.2
-export(float) var GRAVITY: float = 200
export(float) var JUMP_FORCE: float = 100
-export(float) var MAX_FALL_SPEED: float = 1000
export(float) var COYOTE_TIME: float = 250
export(float) var JUMP_BUFFER: float = 220
@@ -26,7 +24,7 @@ func _process(_delta):
#print($AnimationPlayer.current_animation)
func _physics_process(delta):
- velocity.y += delta * GRAVITY
+ velocity.y += delta * GlobalData.GRAVITY
jump_buffer += delta * 1000
if Input.is_action_pressed("move_left"):
@@ -63,7 +61,7 @@ func _physics_process(delta):
if is_on_ceiling():
velocity.y = 1 # Just a bit downwards to not get stuck
- velocity.y = clamp(velocity.y, -INF, MAX_FALL_SPEED)
+ velocity.y = clamp(velocity.y, -INF, GlobalData.MAX_FALL_SPEED)
# TODO fix walking down ramps with snap
# snap needs to be ZERO when jumping
@@ -71,5 +69,3 @@ func _physics_process(delta):
# print($AnimationPlayer.current_animation, ", ", $AnimationTree.get("parameters/walk_speed/scale"))
# warning-ignore:return_value_discarded
move_and_slide(velocity, Vector2.UP)
-
- GlobalData.player_hp
diff --git a/Player.tscn b/Player.tscn
index 65c474e..6de8d4a 100644
--- a/Player.tscn
+++ b/Player.tscn
@@ -43,7 +43,7 @@ nodes/is_grounded/position = Vector2( 400, 90 )
nodes/is_moving/node = SubResource( 15 )
nodes/is_moving/position = Vector2( 140, 190 )
nodes/output/position = Vector2( 620, 100 )
-node_connections = [ "output", 0, "is_grounded", "TimeScale", 0, "Walk", "is_grounded", 0, "Fall", "is_grounded", 1, "is_moving", "is_moving", 0, "Idle", "is_moving", 1, "TimeScale" ]
+node_connections = [ "output", 0, "is_grounded", "is_grounded", 0, "Fall", "is_grounded", 1, "is_moving", "is_moving", 0, "Idle", "is_moving", 1, "TimeScale", "TimeScale", 0, "Walk" ]
[sub_resource type="Animation" id=10]
resource_name = "Fall"
diff --git a/export_presets.cfg b/export_presets.cfg
new file mode 100644
index 0000000..0710ce1
--- /dev/null
+++ b/export_presets.cfg
@@ -0,0 +1,108 @@
+[preset.0]
+
+name="HTML5"
+platform="HTML5"
+runnable=true
+custom_features=""
+export_filter="all_resources"
+include_filter=""
+exclude_filter=""
+export_path="Export/index.html"
+script_export_mode=1
+script_encryption_key=""
+
+[preset.0.options]
+
+custom_template/debug=""
+custom_template/release=""
+variant/export_type=0
+vram_texture_compression/for_desktop=true
+vram_texture_compression/for_mobile=false
+html/export_icon=true
+html/custom_html_shell=""
+html/head_include=""
+html/canvas_resize_policy=2
+html/focus_canvas_on_start=true
+html/experimental_virtual_keyboard=false
+progressive_web_app/enabled=false
+progressive_web_app/offline_page=""
+progressive_web_app/display=1
+progressive_web_app/orientation=0
+progressive_web_app/icon_144x144=""
+progressive_web_app/icon_180x180=""
+progressive_web_app/icon_512x512=""
+progressive_web_app/background_color=Color( 0, 0, 0, 1 )
+
+[preset.1]
+
+name="Mac OSX"
+platform="Mac OSX"
+runnable=true
+custom_features=""
+export_filter="all_resources"
+include_filter=""
+exclude_filter=""
+export_path="Export/export.dmg"
+script_export_mode=1
+script_encryption_key=""
+
+[preset.1.options]
+
+custom_template/debug=""
+custom_template/release=""
+application/name=""
+application/info="Made with Godot Engine"
+application/icon=""
+application/identifier="com.jantuomi.mobileplatformer"
+application/signature=""
+application/app_category="Games"
+application/short_version="1.0"
+application/version="1.0"
+application/copyright=""
+display/high_res=false
+privacy/microphone_usage_description=""
+privacy/camera_usage_description=""
+privacy/location_usage_description=""
+privacy/address_book_usage_description=""
+privacy/calendar_usage_description=""
+privacy/photos_library_usage_description=""
+privacy/desktop_folder_usage_description=""
+privacy/documents_folder_usage_description=""
+privacy/downloads_folder_usage_description=""
+privacy/network_volumes_usage_description=""
+privacy/removable_volumes_usage_description=""
+codesign/enable=false
+codesign/identity=""
+codesign/timestamp=true
+codesign/hardened_runtime=true
+codesign/replace_existing_signature=true
+codesign/entitlements/custom_file=""
+codesign/entitlements/allow_jit_code_execution=false
+codesign/entitlements/allow_unsigned_executable_memory=false
+codesign/entitlements/allow_dyld_environment_variables=false
+codesign/entitlements/disable_library_validation=false
+codesign/entitlements/audio_input=false
+codesign/entitlements/camera=false
+codesign/entitlements/location=false
+codesign/entitlements/address_book=false
+codesign/entitlements/calendars=false
+codesign/entitlements/photos_library=false
+codesign/entitlements/apple_events=false
+codesign/entitlements/debugging=false
+codesign/entitlements/app_sandbox/enabled=false
+codesign/entitlements/app_sandbox/network_server=false
+codesign/entitlements/app_sandbox/network_client=false
+codesign/entitlements/app_sandbox/device_usb=false
+codesign/entitlements/app_sandbox/device_bluetooth=false
+codesign/entitlements/app_sandbox/files_downloads=0
+codesign/entitlements/app_sandbox/files_pictures=0
+codesign/entitlements/app_sandbox/files_music=0
+codesign/entitlements/app_sandbox/files_movies=0
+codesign/custom_options=PoolStringArray( )
+notarization/enable=false
+notarization/apple_id_name=""
+notarization/apple_id_password=""
+notarization/apple_team_id=""
+texture_format/s3tc=true
+texture_format/etc=false
+texture_format/etc2=false