Skip to content

Commit

Permalink
fix crashes and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Sep 14, 2024
1 parent 3df16af commit 579ac1a
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 987 deletions.
190 changes: 97 additions & 93 deletions assets/preload/data/character data/nene/script.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,120 @@ import game.graphics.ABotVis;
import flixe.sound.FlxSound;

var pupilState:Int = 0;

var PUPIL_STATE_NORMAL = 0;
var PUPIL_STATE_LEFT = 1;

var abot:FlxAnimate;
var stereoBG:FlxSprite;
var eyeWhites:FlxSprite;
var pupil:FlxAtlasSprite;
var abotViz:ABotVis;

var time:Float;

//stuff to copy properties to.
// stuff to copy properties to.
var objects:Array<FlxSprite> = [];

function createPost(){
trace('LET HIM COOK!');
stereoBG = new FlxSprite(0, 0, Paths.image('characters/abot/stereoBG', 'shared'));
stereoBG.scrollFactor.set(0.95, 0.95);
objects.push(stereoBG);
eyeWhites = new FlxSprite().makeGraphic(160, 60, FlxColor.WHITE);
objects.push(eyeWhites);
function createPost() {
trace('LET HIM COOK!');
stereoBG = new FlxSprite(0, 0, Paths.image('characters/abot/stereoBG', 'shared'));
stereoBG.scrollFactor.set(0.95, 0.95);
objects.push(stereoBG);
eyeWhites = new FlxSprite().makeGraphic(160, 60, FlxColor.WHITE);
objects.push(eyeWhites);

pupil = new FlxAtlasSprite(0, 0, Paths.getTextureAtlas("characters/abot/systemEyes", "shared"));
pupil.x = character.x;
pupil.y = character.y;
pupil.scrollFactor.set(0.95, 0.95);
pupil.antialiasing = Options.getData("antialiasing");
objects.push(pupil);
pupil.scrollFactor.set(0.95, 0.95);
pupil.antialiasing = Options.getData("antialiasing");
objects.push(pupil);

abot = new FlxAnimate(0, 0, Paths.getTextureAtlas("characters/abot/abotSystem", "shared"));
abot.x = character.x;
abot.y = character.y;
abot.scrollFactor.set(0.95, 0.95);
abot.antialiasing = Options.getData("antialiasing");
objects.push(abot);

FlxG.sound.music = new FlxSound().loadEmbedded(Paths.inst(PlayState.SONG.song, (PlayState.SONG.specialAudioName == null ? PlayState.instance.storyDifficultyStr.toLowerCase() : PlayState.SONG.specialAudioName)));
FlxG.sound.music.play();
FlxG.sound.music.volume = 0;
abotViz = new ABotVis();
abot.scrollFactor.set(0.95, 0.95);
abot.antialiasing = Options.getData("antialiasing");
objects.push(abot);

FlxG.sound.music = new FlxSound().loadEmbedded(Paths.inst(PlayState.SONG.song,
(PlayState.SONG.specialAudioName == null ? PlayState.instance.storyDifficultyStr.toLowerCase() : PlayState.SONG.specialAudioName)));
FlxG.sound.music.play();
FlxG.sound.music.volume = 0;
abotViz = new ABotVis();
abotViz.x = character.x + 100;
abotViz.y = character.y + 400;
abotViz.antialiasing = Options.getData("antialiasing");
abotViz.scrollFactor.set(0.95, 0.95);
objects.push(abotViz);
FlxG.sound.music.pause();



abot.x = character.x - 100;
abot.y = character.y + 316; // 764 - 740

PlayState.instance.addBehindGF(stereoBG);
PlayState.instance.addBehindGF(eyeWhites);
PlayState.instance.addBehindGF(pupil);
PlayState.instance.addBehindGF(abotViz);
PlayState.instance.addBehindGF(abot);

eyeWhites.x = abot.x + 40;
eyeWhites.y = abot.y + 250;
eyeWhites.antialiasing = Options.getData("antialiasing");
eyeWhites.scrollFactor.set(0.95, 0.95);

pupil.x = character.x - 607;
pupil.y = character.y - 176;

stereoBG.x = abot.x + 150;
stereoBG.y = abot.y + 30;
stereoBG.antialiasing = Options.getData("antialiasing");
abotViz.antialiasing = Options.getData("antialiasing");
abotViz.scrollFactor.set(0.95, 0.95);
objects.push(abotViz);
FlxG.sound.music.pause();

abot.x = character.x - 100;
abot.y = character.y + 316; // 764 - 740

PlayState.instance.addBehindGF(stereoBG);
PlayState.instance.addBehindGF(eyeWhites);
PlayState.instance.addBehindGF(pupil);
PlayState.instance.addBehindGF(abotViz);
PlayState.instance.addBehindGF(abot);

eyeWhites.x = abot.x + 40;
eyeWhites.y = abot.y + 250;
eyeWhites.antialiasing = Options.getData("antialiasing");
eyeWhites.scrollFactor.set(0.95, 0.95);

pupil.x = character.x - 607;
pupil.y = character.y - 176;

stereoBG.x = abot.x + 150;
stereoBG.y = abot.y + 30;
stereoBG.antialiasing = Options.getData("antialiasing");

character.x += 30;
character.y += 5;
}

character.x += 20;
character.y += 5;
function dance() {
if (abot != null) {
abot.anim.play("");
abot.anim.curFrame = 1; // we start on this frame, since from Flash the symbol has a non-bumpin frame on frame 0
}
}

function startSong() {
FlxG.sound.music.play();
FlxG.sound.music.volume = 1;
FlxG.sound.music.play();
FlxG.sound.music.volume = 1;
movePupilsLeft();

}

function updatePost(elapsed:Float) {
// Set the properties of ABot to match Nene's.
for (object in objects){
object.visible = character.visible;
object.alpha = character.alpha;
object.shader = character.shader;
object.color = character.color;
object.colorTransform = character.colorTransform;
object.scrollFactor = character.scrollFactor;
}

if (pupil.anim.isPlaying)
{
switch (pupilState)
{
case PUPIL_STATE_NORMAL:
if (pupil.anim.curFrame >= 17)
{
pupilState = PUPIL_STATE_LEFT;
pupil.anim.pause();
}

case PUPIL_STATE_LEFT:
if (pupil.anim.curFrame >= 31)
{
pupilState = PUPIL_STATE_NORMAL;
pupil.anim.pause();
}

}
}
// Set the properties of ABot to match Nene's.
for (object in objects) {
object.visible = character.visible;
object.alpha = character.alpha;
object.shader = character.shader;
object.color = character.color;
object.colorTransform = character.colorTransform;
object.scrollFactor = character.scrollFactor;
}

if (pupil.anim.isPlaying) {
switch (pupilState) {
case PUPIL_STATE_NORMAL:
if (pupil.anim.curFrame >= 17) {
pupilState = PUPIL_STATE_LEFT;
pupil.anim.pause();
}

case PUPIL_STATE_LEFT:
if (pupil.anim.curFrame >= 31) {
pupilState = PUPIL_STATE_NORMAL;
pupil.anim.pause();
}
}
}
}
function turnChange(turn:String){

function turnChange(turn:String) {
switch (turn) {
case 'dad':
movePupilsRight();
Expand All @@ -124,16 +125,19 @@ function turnChange(turn:String){
trace('no match!');
}
}

function movePupilsLeft():Void {
if (pupilState == PUPIL_STATE_LEFT) return;
pupil.anim.play('');
pupil.anim.curFrame = 0;
// pupilState = PUPIL_STATE_LEFT;
if (pupilState == PUPIL_STATE_LEFT)
return;
pupil.anim.play('');
pupil.anim.curFrame = 0;
// pupilState = PUPIL_STATE_LEFT;
}

function movePupilsRight():Void {
if (pupilState == PUPIL_STATE_NORMAL) return;
pupil.anim.play('');
pupil.anim.curFrame = 17;
// pupilState = PUPIL_STATE_NORMAL;
}
if (pupilState == PUPIL_STATE_NORMAL)
return;
pupil.anim.play('');
pupil.anim.curFrame = 17;
// pupilState = PUPIL_STATE_NORMAL;
}
4 changes: 0 additions & 4 deletions assets/preload/data/defaultOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@
"option": "biggerInfoText",
"value": false
},
{
"option": "oldTitle",
"value": false
},
{
"option": "watermarks",
"value": true
Expand Down
2 changes: 1 addition & 1 deletion assets/preload/data/stage data/blazin.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import flixel.addons.display.FlxTiledSprite;
import utilities.MathUtil;


var rainShader:CustomShader = new CustomShader(Assets.getText(Paths.frag("rain")), null, 100);
var rainShader:CustomShader = new CustomShader(Assets.getText(Paths.frag("rain")));
var rainShaderFilter:ShaderFilter;
var scrollingSky:FlxTiledSprite;

Expand Down
2 changes: 1 addition & 1 deletion assets/preload/data/stage data/streets.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import flixel.addons.display.FlxTiledSprite;
import flixel.math.FlxPoint;


var rainShader:CustomShader = new CustomShader(Assets.getText(Paths.frag("rain")), null, 100);
var rainShader:CustomShader = new CustomShader(Assets.getText(Paths.frag("rain")));
var rainShaderFilter:ShaderFilter;
var blurFilter:BlurFilter = new BlurFilter(6, 6);

Expand Down
Loading

0 comments on commit 579ac1a

Please sign in to comment.