Skip to content

Commit

Permalink
Update project.godot
Browse files Browse the repository at this point in the history
  • Loading branch information
Ymanawat committed Jul 22, 2023
1 parent 7ff5590 commit af6437b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 2d/procedural_platform_level_generator/Scene/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ func _process(delta):
func _on_tile_map_game_over():
$Player.set_physics_process(false)
$Game_over.play()

func _on_game_over_finished():
get_tree().reload_current_scene()
10 changes: 5 additions & 5 deletions 2d/procedural_platform_level_generator/Scene/TileMapLine.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ func remove_cells():
func _process(delta):
if player!=null:
playerPosition = player.position

if next_tile_position.x < (playerPosition.x + screenWidth):
generate_tiles()

if prev_tile_position.x < playerPosition.x - 160.0:
remove_cells()

# Check for collision with tile1
playerCellPos = local_to_map(playerPosition)
Interacted_Tile_Index = get_cell_source_id(0, playerCellPos)

if Interacted_Tile_Index == PlateTileIndex:
# Obstacle indexed 1 tile
$"../Hit_sound".play()
set_cell(0, playerCellPos, -1)
emit_signal("score")

elif Interacted_Tile_Index == LineTileIndex:
# Line indexed 0 tile
if not game_over_signal:
Expand Down
6 changes: 3 additions & 3 deletions 2d/procedural_platform_level_generator/Scene/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func _physics_process(delta):
if (player_state == State.IDLE):
rotation += rotationSpeed * delta
moveDistance=screenHeight/2

if (player_state == State.MOVE):
position-=offset
moveDistance-=abs(offset.y)*1.15

if((moveDistance)<=0):
player_state = State.IDLE

move_and_slide()

func _game_over():
Expand Down
8 changes: 8 additions & 0 deletions 2d/procedural_platform_level_generator/project.godot
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
; 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]
Expand Down

0 comments on commit af6437b

Please sign in to comment.