Skip to content

Commit

Permalink
yay achievements work + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Oct 22, 2024
1 parent f76c184 commit bc8becf
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion assets/achievements/amazing.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Amazing!",
"name": "Amazing",
"desc": "Looking good!",
"hint": "Get an A on any song."
}
2 changes: 1 addition & 1 deletion assets/achievements/be_better.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Be better!",
"name": "Be better",
"desc": "Try a little harder!",
"hint": "Get a B on any song."
}
2 changes: 1 addition & 1 deletion assets/achievements/dont_give_up.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Don't Give Up",
"name": "Dont Give Up",
"desc": "Believe in yourself!",
"hint": "Get a D on any song."
}
2 changes: 1 addition & 1 deletion assets/achievements/failed.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Failed...",
"name": "Failed",
"desc": "Yeah, maybe try botplay for a bit.",
"hint": "Get an F on any song."
}
2 changes: 1 addition & 1 deletion assets/achievements/perfect.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Perfect!",
"name": "Perfect",
"desc": "Wow, you did it!",
"hint": "Get a P on any song."
}
2 changes: 1 addition & 1 deletion assets/achievements/super.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Super!",
"name": "Super",
"desc": "Keep going!",
"hint": "Get an S on any song."
}
4 changes: 3 additions & 1 deletion source/backend/Achievements.hx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Achievements {
achBG.scrollFactor.set();
sprGroup.add(achBG);

var achIcon:FlxSprite = new FlxSprite(achBG.x + 10, achBG.y - 10).loadGraphic(Paths.image('achievements/$ach'));
var achIcon:FlxSprite = new FlxSprite(achBG.x + 10, achBG.y + 10).loadGraphic(Paths.image('achievements/$ach'));
achIcon.setGraphicSize(Std.int(achIcon.width * (2 / 3)));
achIcon.scrollFactor.set();
sprGroup.add(achIcon);
Expand All @@ -128,6 +128,8 @@ class Achievements {
var where = FlxG.state.subState != null ? FlxG.state.subState : FlxG.state;
where.add(sprGroup);

FlxG.sound.play(Paths.sound('start'));

FlxTween.tween(flash, {alpha: 0}, 0.65, {
onComplete: (twn:FlxTween) -> {
sprGroup.remove(flash);
Expand Down
3 changes: 3 additions & 0 deletions source/states/AchievementsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class AchievementsState extends ExtendableState {
override function create() {
super.create();

FlxG.mouse.visible = true;

camFollow = new FlxObject(80, 0, 0, 0);
camFollow.screenCenter(X);
add(camFollow);
Expand Down Expand Up @@ -74,6 +76,7 @@ class AchievementsState extends ExtendableState {
changeSelection(Input.justPressed('up') ? -1 : 1);

if (Input.justPressed('exit')) {
FlxG.mouse.visible = false;
FlxG.sound.play(Paths.sound('cancel'));
ExtendableState.switchState(new MenuState());
}
Expand Down
9 changes: 9 additions & 0 deletions source/states/MenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class MenuState extends ExtendableState {

changeSelection(0, false, false);

var curDate = Date.now();
if (curDate.getDay() == 5 && curDate.getHours() >= 18)
Achievements.unlock('freaky_friday', {
date: Date.now(),
song: 'None'
}, () -> {
trace('getting freaky on a friday night yeah');
});

FlxG.camera.follow(camFollow, null, 0.15);
}

Expand Down
9 changes: 6 additions & 3 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class PlayState extends ExtendableState {
public static var chartingMode:Bool = false;
public static var gotAchievement:Bool = false;

public static var konami:Int = 0;
public static var didKonami:Bool = false;
public var konami:Int = 0;
public var didKonami:Bool = false;

public var speed:Float = 1;

Expand Down Expand Up @@ -459,9 +459,12 @@ class PlayState extends ExtendableState {
konami = 0;
}
}

if (konami == 8) {
didKonami = true;
FlxG.sound.play(Paths.sound('start'));
new FlxTimer().start(0.01, (tmr:FlxTimer) -> {
FlxG.sound.play(Paths.sound('start'));
});
}

// prevent player input when botplay is on
Expand Down

0 comments on commit bc8becf

Please sign in to comment.