Skip to content

Commit

Permalink
changed design
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey Sivachinski authored and Matvey Sivachinski committed Feb 5, 2024
1 parent a723216 commit a47b7c3
Show file tree
Hide file tree
Showing 42 changed files with 849 additions and 49 deletions.
40 changes: 30 additions & 10 deletions addons/pronto/behaviors/PlatformerControllerBehavior.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ class_name PlatformerControllerBehavior

@export_category("Gameplay")
## Defines the available controls
enum Player {
Player_1 = 0, ## A - D, W or Space to jump
Player_2 = 1, ## Arrow keys, up to jump
Player_3 = 2 ## J - L, I to jump
enum Controls {
WASD = 0, ## A - D, Jump: Space
Arrow_Keys = 1, ## Arrow keys
IJKL = 2 ## J - L, Jump: I
}

## Determines which controls (keys) are used.
## Which keys that are is defined in [member PlatformControllerBehavior.key_map]
##
## See [enum PlatformControllerBehavior.Controls] for possible values
@export var player: Player = Player.Player_1
@export var controls: Controls = Controls.Arrow_Keys
## The speed with which the character jumps.
@export var jump_velocity: float = 400:
set(v):
Expand Down Expand Up @@ -49,6 +49,26 @@ var _last_positions = []

signal collided(last_collision: KinematicCollision2D)

# Make sure that these keys are identical to the comments from the enum "Controls" above when changing them.
var key_map = [{
"function": Input.is_physical_key_pressed,
"left": KEY_A,
"right": KEY_D,
"jump": [KEY_SPACE, KEY_W]
},
{
"function": Input.is_action_pressed,
"left": "ui_left",
"right": "ui_right",
"jump": "ui_up"
},
{
"function": Input.is_physical_key_pressed,
"left": KEY_J,
"right": KEY_L,
"jump": KEY_I
}]

func _enter_tree():
if not get_parent() is CharacterBody2D:
push_error("PlatformerController must be a child of a CharacterBody2D")
Expand Down Expand Up @@ -82,12 +102,12 @@ func _draw():
for pos in _last_positions:
draw_circle(pos, 3, Color.RED)

#const valid_directions = ["left", "right", "jump"]
func _is_key_pressed(direction):
#if not direction in valid_directions:
#push_error("Direction must be one of {0} (got {1})".format(", ".join(valid_directions), direction))
var action_string = "player_{0}_{1}".format([str(player), direction])
return Input.is_action_pressed(action_string)
var keys = key_map[controls]
if (typeof(keys[direction]) == TYPE_ARRAY):
return keys[direction].any(func(key): return keys["function"].call(key))
else:
return keys["function"].call(keys[direction])

func _physics_process(delta):
if Engine.is_editor_hint():
Expand Down
Binary file added prototypes/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://b8yv3molmyxfb"
path="res://.godot/imported/Double Jump (32x32).png-f9c754cad5fdc07a50cad7c14c4ea11c.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Double Jump (32x32).png"
dest_files=["res://.godot/imported/Double Jump (32x32).png-f9c754cad5fdc07a50cad7c14c4ea11c.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dslkgcje724ld"
path="res://.godot/imported/Fall (32x32).png-dd94e3f9e148313a000034c2430cd27a.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Fall (32x32).png"
dest_files=["res://.godot/imported/Fall (32x32).png-dd94e3f9e148313a000034c2430cd27a.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://c2bl3q150bx1t"
path="res://.godot/imported/Hit (32x32).png-c61e5da5c9192dadeb3b4755cae32a27.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Hit (32x32).png"
dest_files=["res://.godot/imported/Hit (32x32).png-c61e5da5c9192dadeb3b4755cae32a27.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dx884i5e2o8ql"
path="res://.godot/imported/Idle (32x32).png-45efc1a7a294480c6b2834a58656718e.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Idle (32x32).png"
dest_files=["res://.godot/imported/Idle (32x32).png-45efc1a7a294480c6b2834a58656718e.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://uslhwqbdovi1"
path="res://.godot/imported/Jump (32x32).png-ada1d7faf49f934eaa12ecf6f44e732e.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Jump (32x32).png"
dest_files=["res://.godot/imported/Jump (32x32).png-ada1d7faf49f934eaa12ecf6f44e732e.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cg51l4o67emhb"
path="res://.godot/imported/Run (32x32).png-296b368a9b666ea910c0c35d9f7d8852.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Run (32x32).png"
dest_files=["res://.godot/imported/Run (32x32).png-296b368a9b666ea910c0c35d9f7d8852.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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cmfu34nhl06te"
path="res://.godot/imported/Wall Jump (32x32).png-d5061836552c1a05e8b84a05e8126919.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://prototypes/game-shadows-of-surveillance/characters/Pink Man/Wall Jump (32x32).png"
dest_files=["res://.godot/imported/Wall Jump (32x32).png-d5061836552c1a05e8b84a05e8126919.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
Loading

0 comments on commit a47b7c3

Please sign in to comment.