Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Achievements fixed (maybe) (#93)
Browse files Browse the repository at this point in the history
* Trying to fix the freaking bug

* Let’s see

* Update Achievements.hx

* FIXED YEESSS

Co-authored-by: Theoyeah <[email protected]>
  • Loading branch information
Wither362 and Theoyeah authored May 15, 2022
1 parent 65a4702 commit 5898128
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
8 changes: 5 additions & 3 deletions source/Achievements.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ class Achievements {

public static function getAchievementIndex(name:String) {
for (i in 0...achievementsStuff.length) {
if(achievementsStuff[i][2] == name) {
return i;
if(achievementsStuff[i][2] != null) {
if(achievementsStuff[i][2] == name) {
return i;
}
}
}
return -1;
Expand Down Expand Up @@ -181,4 +183,4 @@ class AchievementObject extends FlxSpriteGroup {
}
super.destroy();
}
}
}
17 changes: 2 additions & 15 deletions source/AchievementsMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import lime.utils.Assets;
import lime.app.Application;
import flixel.FlxSubState;
import Achievements;

Expand All @@ -27,15 +26,12 @@ class AchievementsMenuState extends MusicBeatState
private var achievementArray:Array<AttachedAchievement> = [];
private var achievementIndex:Array<Int> = [];
private var descText:FlxText;
var descBox:AttachedSprite;

override function create() {
#if desktop
DiscordClient.changePresence("Achievements Menu", null);
#end

Application.current.window.title = "Friday Night Funkin': Theoyeah Engine - " + "Awards Menu";

var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuBGBlue'));
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
menuBG.updateHitbox();
Expand All @@ -47,7 +43,7 @@ class AchievementsMenuState extends MusicBeatState
add(grpOptions);

Achievements.loadAchievements();
for (i in 0...Achievements.achievementsStuff.length-1) {
for (i in 0...Achievements.achievementsStuff.length) {
if(!Achievements.achievementsStuff[i][4] || Achievements.achievementsMap.exists(Achievements.achievementsStuff[i][2])) {
options.push(Achievements.achievementsStuff[i]);
achievementIndex.push(i);
Expand All @@ -73,18 +69,9 @@ class AchievementsMenuState extends MusicBeatState
descText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
descText.scrollFactor.set();
descText.borderSize = 2.4;
descBox.sprTracker = descText;
add(descText);
changeSelection();

descBox = new AttachedSprite();
descBox.makeGraphic(1, 1, FlxColor.BLACK);
descBox.xAdd = -10;
descBox.yAdd = -10;
descBox.alphaMult = 0.6;
descBox.alpha = 0.6;
add(descBox);

super.create();
}

Expand Down Expand Up @@ -133,4 +120,4 @@ class AchievementsMenuState extends MusicBeatState
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
}
#end
}
}

0 comments on commit 5898128

Please sign in to comment.