Skip to content

Commit

Permalink
remove junk
Browse files Browse the repository at this point in the history
  • Loading branch information
avivajpeyi committed Oct 9, 2024
1 parent 3ffd316 commit 3b3bff2
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 148 deletions.
5 changes: 5 additions & 0 deletions Globals/LeaderboardManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var player_ranking:int
signal leaderboard_data_updated
signal player_data_posted

var posting_allowed:bool = false

func _ready():
_connect_to_leaderboard()
_get_top_scores()
Expand All @@ -26,6 +28,9 @@ func _clear_leaderboard():


func _post_score(score:float):
if !posting_allowed:
print("SCORE POSTING DISABLED")
return
print("psting score ", score)
var score_to_save = score*-1
var sw_result: Dictionary = await SilentWolf.Scores.save_score(global.player_name, score_to_save).sw_save_score_complete
Expand Down
87 changes: 0 additions & 87 deletions Leaderboard/TimeBasedLboards.gd

This file was deleted.

95 changes: 92 additions & 3 deletions Leaderboard/TimeBasedLboards.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,102 @@
[gd_scene load_steps=5 format=3 uid="uid://bsxtktsci8a4t"]
[gd_scene load_steps=5 format=3 uid="uid://djqudciw5bbmh"]

[ext_resource type="Theme" uid="uid://d2eakbmaefnt6" path="res://addons/silent_wolf/assets/themes/sw_theme.tres" id="2_xs0b2"]
[ext_resource type="PackedScene" uid="uid://clllbf6am8qdf" path="res://addons/silent_wolf/common/SWButton.tscn" id="4"]
[ext_resource type="Script" path="res://Leaderboard/TimeBasedLboards.gd" id="5"]

[sub_resource type="GDScript" id="GDScript_wvlpb"]
script/source = "extends Node2D

const ScoreItem = preload(\"SmallScoreItem.tscn\")
const SWLogger = preload(\"res://addons/silent_wolf/utils/SWLogger.gd\")

var ld_names = [\"Weekly\", \"Monthly\", \"main\"]

var scores = []

func _ready():
SilentWolf.Scores.sw_get_scores_complete.connect(_on_scores_received)

#var scores = SilentWolf.Scores.scores
add_loading_scores_message()
var sw_result = SilentWolf.Scores.get_scores(10, \"main\")
scores = sw_result.scores
# the other leaderboard scores will be called once the main call in finished
# (see signal connected above and _on_scores_received function below)
# when all the scores are loaded the leaderboard scene can be opened


func render_boards(leaderboards: Array) -> void:
#print(\"leaderboards: \" + str(leaderboards))
var board_number = 0
for board in leaderboards:
var list_index = 1
#print(\"ld name: \" + str(ld_names[board_number]))
#print(\"ld scores: \" + str(board))
for score in board:
add_item(ld_names[board_number], score.player_name, str(int(score.score)), list_index)
list_index += 1
board_number += 1


func add_item(ld_name: String, player_name: String, score: String, list_index: int) -> void:
var item = ScoreItem.instantiate()
item.get_node(\"PlayerName\").text = str(list_index) + str(\". \") + player_name
item.get_node(\"Score\").text = score
item.offset_top = list_index * 100
get_node(\"MainContainer/Boards/\" + ld_name + \"/HighScores/ScoreItemContainer\").add_child(item)


func add_no_scores_message() -> void:
var item = $\"MainContainer/MessageContainer/TextMessage\"
item.text = \"No scores yet!\"
$\"MainContainer/MessageContainer\".show()
item.offset_top = 135


func add_loading_scores_message() -> void:
var item = $\"MainContainer/MessageContainer/TextMessage\"
item.text = \"Loading scores...\"
$\"MainContainer/MessageContainer\".show()
item.offset_top = 135


func hide_message() -> void:
$\"MainContainer/MessageContainer\".hide()


func _on_CloseButton_pressed() -> void:
var scene_name = SilentWolf.scores_config.open_scene_on_close
SWLogger.info(\"Closing SilentWolf leaderboard, switching to scene: \" + str(scene_name))
get_tree().change_scene_to_file(scene_name)


func _on_scores_received(get_scores_result: Dictionary) -> void:
var ld_name: String = get_scores_result.ld_name
var scores: Array = get_scores_result.scores

if ld_name == \"main\":
SilentWolf.Scores.get_scores(10, \"Weekly\")
#SilentWolf.Scores.get_scores(10, \"Weekly\", -1)
elif ld_name == \"Weekly\":
SilentWolf.Scores.get_scores(10, \"Monthly\")
else:
#print(\"SilentWolf.Scores.leaderboards: \" + str(SilentWolf.Scores.leaderboards))
var ld_scores = []
for i in [0, 1, 2]:
if ld_names[i] in SilentWolf.Scores.leaderboards:
ld_scores.append(SilentWolf.Scores.leaderboards[ld_names[i]])
#elif (ld_names[i] + \";-1\") in SilentWolf.Scores.leaderboards_past_periods:
# ld_scores.append(SilentWolf.Scores.leaderboards_past_periods[(ld_names[i] + \";-1\")])
else:
ld_scores.append([])
hide_message()
render_boards(ld_scores)
"
[sub_resource type="Theme" id="3"]
[node name="TimeBasedLBoards" type="Node2D"]
script = ExtResource("5")
script = SubResource("GDScript_wvlpb")
[node name="MainContainer" type="VBoxContainer" parent="."]
offset_left = 412.0
Expand Down
Binary file modified Levels/tilesets/tileset_16px.res
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# TowerFall

- [itch.io page](https://avivajpeyi.itch.io/towerfall)
- Godot4.3 game played with one button
- Use walljumping abilities to help your critter make it out of the tower

Expand All @@ -14,4 +15,3 @@
### Assets

- [Kenny 1-Bit platformer pack](https://kenney.nl/assets/1-bit-platformer-pack)
-
57 changes: 0 additions & 57 deletions test_breakables_and_door.tscn

This file was deleted.

0 comments on commit 3b3bff2

Please sign in to comment.