Skip to content

Commit

Permalink
implemented castle jump n run
Browse files Browse the repository at this point in the history
  • Loading branch information
Predatorcero committed Nov 5, 2023
1 parent a500633 commit 0799ce7
Show file tree
Hide file tree
Showing 14 changed files with 5,381 additions and 74 deletions.
32 changes: 32 additions & 0 deletions prototypes/game-baerlachTest/Key1.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
extends CharacterBody2D


const SPEED = 300.0
const JUMP_VELOCITY = -400.0

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = 0 #ProjectSettings.get_setting("physics/2d/default_gravity")

func appear():
visible = true
collision_layer = 1
collision_mask = 1

func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y += gravity * delta

# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY

# 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)

move_and_slide()
47 changes: 47 additions & 0 deletions prototypes/game-baerlachTest/Player.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
extends CharacterBody2D


@export var key1 = 0
@export var key2 = 0
@export var key3 = 0
func add_key1():
key1 = 1

func add_key2():
key2 = 1

func add_key3():
key3 = 1


func set_camera_zoom(zoom_level):
$Camera2D.zoom=Vector2(zoom_level,zoom_level)

const SPEED = 300.0
const JUMP_VELOCITY = -400.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("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY

# 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)

move_and_slide()
14 changes: 14 additions & 0 deletions prototypes/game-baerlachTest/blocker.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends RigidBody2D

func block():
collision_layer = 1
collision_mask = 1
visible = 1
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
14 changes: 14 additions & 0 deletions prototypes/game-baerlachTest/door1.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends RigidBody2D

func open(key):
if key == 1:
queue_free()

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
Loading

0 comments on commit 0799ce7

Please sign in to comment.