Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage (hscript based) isn't working #16075

Closed
Ilya02273 opened this issue Dec 23, 2024 · 0 comments
Closed

Stage (hscript based) isn't working #16075

Ilya02273 opened this issue Dec 23, 2024 · 0 comments
Labels
question Further information is requested

Comments

@Ilya02273
Copy link

What is your question?

`haxe
import flixel.text.FlxText;

var dadVersion: String = PlayState.SONG.player2.toLowerCase();
var curSong: String = PlayState.SONG.song.toLowerCase();

var bg: FlxSprite;
var fg: FlxSprite;
var mainlight: FlxSprite;
var trickyStatic: FlxSprite;

var trickyText: FlxText;

var textRendered: Bool = false;

var TrickyLinesSing: Array < String > = [
"SUFFER",
"INCORRECT",
"INCOMPLETE",
"INSUFFICIENT",
"INVALID",
"CORRECTION",
"MISTAKE",
"REDUCE",
"ERROR",
"ADJUSTING",
"IMPROBABLE",
"IMPLAUSIBLE",
"MISJUDGED"
];
var TrickyLinesMiss: Array < String > = [
"TERRIBLE",
"WASTE",
"MISS CALCULTED",
"PREDICTED",
"FAILURE",
"DISGUSTING",
"ABHORRENT",
"FORESEEN",
"CONTEMPTIBLE",
"PROGNOSTICATE",
"DISPICABLE",
"REPREHENSIBLE"
];

var antialiasing: Bool = ClientPrefs.data.antialiasing;
var lowQuality: Bool = ClientPrefs.data.lowQuality;

function onCreatePost() {
//bg
bg = new FlxSprite(200,
-100).loadGraphic(Paths.image('stages/red'));
bg.antialiasing = antialiasing;
bg.scrollFactor.set(0.9, 0.9);
bg.scale.set(1.2, 1.2);
//fg
fg = new FlxSprite(-540,-382);
if (curSong == 'improbable-outset') fg.loadGraphic(Paths.image('stages/nevada/island_but_dumb'));
else fg.loadGraphic(Paths.image('stages/nevada/island_but_rocks_float'));
fg.antialiasing = antialiasing;
fg.scrollFactor(0.9, 0.9);
fg.scale.set(1.4, 1.4);
//mainlight
mainlight = new FlxSprite(-470, -150).loadGraphic(Paths.image('stages/hue'));
mainlight.antialiasing = antialiasing;
mainlight.scrollFactor(1.2, 1.2);
mainlight.scale.set(0.9, 0.9);
mainlight.alpha = 0.3;
mainlight.blend = 'screen';
//trickyStatic
trickyStatic = new FlxSprite(0, 0).loadGraphic(Paths.image('stages/TrickyStatic'));
trickyStatic.antialiasing = false;
trickyStatic.scale.set(8.3, 8.3);
trickyStatic.alpha = 0;
trickyStatic.cameras = [camHUD];
trickyStatic.screenCenter();
game.insert(game.members.indexOf('game.dad')+9, trickyStatic);
//trickyText
trickyText = new FlxText(0, 0, 0, '', 20);
trickyText.setFormat(Paths.font('impact.ttf'), 128, 0xff0000);
trickyText.bold = true;
trickyText.visible = false;
game.insert(game.members.indexOf('game.dad')+10, trickyText);
//add
if (curSong == 'improbable-outset' && !lowQuality) addBehindGF(bg);
addBehindGF(fg);
addBehindGF(mainlight);
add(trickyStatic);
add(trickyText);
}

function opponentNoteHit(n) {
if (dadVersion == 'tricky-mask') {
if (FlxG.random.bool(1) && !n.isSustainNote && !textRendered) createText(TrickyLinesSing[FlxG.random.int(0, TrickyLinesSing.length)]);
} else if (dadVersion == 'tricky') {
if (FlxG.random.bool(20) && !n.isSustainNote && !textRendered) createText(TrickyLinesSing[FlxG.random.int(0, TrickyLinesSing.length)]);
}
}

function noteMiss(n) {
if ((dadVersion == 'tricky-mask' || dadVersion == 'tricky') && !n.isSustainNote && !textRendered) createText(TrickyLinesMiss[FlxG.random.int(0, TrickyLinesMiss.length)]);
}

function createText(lineText: String) {
textRendered = true;
trickyText.visible = true;
trickyText.x = FlxG.random.float(game.dad.x + 40, game.dad.x + 120);
trickyText.y = FlxG.random.float(game.dad.y + 200, game.dad.y + 300);
trickyText.angle = FlxG.random.int(-5, 5);
trickyText.text = lineText;
FlxTween.tween(trickyStatic, {
alpha: 0.5
}, 0.067, {
ease: FlxEase.elasticIn, onComplete: function(twn: FlxTween) {}
});
FlxG.sound.play(Paths.sound('staticSound'));
new FlxTimer().start(0.125, function(tmr: FlxTimer) {
FlxTween.tween(trickyStatic, {
alpha: 0
}, 0.04, {
ease: FlxEase.elasticIn, onComplete: function(twn: FlxTween) {
textRendered = false;
trickyText.visible = false;
}
});
});
}
`
Sprites aren't loading

@Ilya02273 Ilya02273 added the question Further information is requested label Dec 23, 2024
@Ilya02273 Ilya02273 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant