@@ -4,80 +4,50 @@ import flixel.FlxG;
4
4
import flixel.FlxSprite;
5
5
import flixel.group.FlxTypedSpriteGroup;
6
6
import funkin.graphics.FunkinSprite;
7
- import funkin.Paths;
8
7
import funkin.modding.base.ScriptedFlxAtlasSprite;
9
8
import funkin.modding.base.ScriptedFlxSprite;
10
9
import funkin.modding.base.ScriptedFlxSpriteGroup;
11
10
import funkin.graphics.adobeanimate.FlxAtlasSprite;
12
11
import funkin.audio.visualize.ABotVis;
13
- import funkin.util.assets.SoundUtil;
14
- import funkin.vis.dsp.SpectralAnalyzer;
15
- import funkin.util.PlatformUtil;
16
- import funkin.util.HostPlatform;
17
- import Lambda;
18
-
19
- // using Lambda;
20
12
21
13
class NeneCharacter extends SparrowCharacter {
22
14
function new() {
23
15
super('nene');
24
16
}
25
17
26
- var analyzer:SpectralAnalyzer;
27
-
28
18
var pupilState:Int = 0;
29
19
30
20
var PUPIL_STATE_NORMAL = 0;
31
21
var PUPIL_STATE_LEFT = 1;
32
22
33
23
var abot:FlxAtlasSprite;
34
- var abotViz:FlxTypedSpriteGroup ;
24
+ var abotViz:ABotVis ;
35
25
var stereoBG:FlxSprite;
36
26
var eyeWhites:FlxSprite;
37
27
var pupil:FlxAtlasSprite;
38
28
39
29
function onCreate(event:ScriptEvent) {
40
30
super.onCreate(event);
31
+
41
32
stereoBG = new FlxSprite(0, 0, Paths.image('characters/abot/stereoBG'));
33
+
42
34
eyeWhites = new FunkinSprite().makeSolidColor(160, 60);
35
+
43
36
pupil = new FlxAtlasSprite(0, 0, Paths.animateAtlas("characters/abot/systemEyes", "shared"));
44
37
pupil.x = this.x;
45
38
pupil.y = this.y;
39
+ pupil.zIndex = this.zIndex - 5;
46
40
47
41
abot = ScriptedFlxAtlasSprite.init('ABotAtlasSprite', 0, 0);
48
42
abot.x = this.x;
49
43
abot.y = this.y;
44
+ abot.zIndex = this.zIndex - 1;
50
45
51
- abotViz = new FlxTypedSpriteGroup( );
46
+ abotViz = new ABotVis(FlxG.sound.music );
52
47
abotViz.x = this.x;
53
48
abotViz.y = this.y;
49
+ abotViz.zIndex = abot.zIndex + 1;
54
50
FlxG.debugger.track(abotViz);
55
-
56
- var visFrms:FlxAtlasFrames = Paths.getSparrowAtlas('aBotViz');
57
-
58
- // these are the differences in X position, from left to right
59
- var positionX:Array<Float> = [0, 59, 56, 66, 54, 52, 51];
60
- var positionY:Array<Float> = [0, -8, -3.5, -0.4, 0.5, 4.7, 7];
61
-
62
- for (lol in 0...7)
63
- {
64
- // pushes initial value
65
- var posX:Float = 0;
66
- var posY:Float = 0;
67
-
68
- for (i in 0...lol+1){
69
- posX += positionX[i];
70
- posY += positionY[i];
71
- }
72
-
73
- var viz:FlxSprite = new FlxSprite(posX, posY);
74
- viz.frames = visFrms;
75
- abotViz.add(viz);
76
-
77
- var visStr = 'viz';
78
- viz.animation.addByPrefix('VIZ', visStr + Std.string(lol+1), 0);
79
- viz.animation.play('VIZ', false, false, 6);
80
- }
81
51
}
82
52
83
53
/**
@@ -199,6 +169,7 @@ class NeneCharacter extends SparrowCharacter {
199
169
default:
200
170
}
201
171
}
172
+
202
173
}
203
174
204
175
function movePupilsLeft():Void {
@@ -249,7 +220,11 @@ class NeneCharacter extends SparrowCharacter {
249
220
function onUpdate(event:UpdateScriptEvent) {
250
221
super.onUpdate(event);
251
222
252
- pupil.update(event.elapsed);
223
+ // Set the visibility of ABot to match Nene's.
224
+ abot.visible = this.visible;
225
+ pupil.visible = this.visible;
226
+ eyeWhites.visible = this.visible;
227
+ stereoBG.visible = this.visible;
253
228
254
229
if (pupil?.anim?.isPlaying)
255
230
{
@@ -276,21 +251,33 @@ class NeneCharacter extends SparrowCharacter {
276
251
// refreshes just for the zIndex shit!
277
252
if (!refershedLol)
278
253
{
279
- abot.x = this.x - 132;
280
- abot.y = this.y + 310;
254
+ abot.x = this.x - 100;
255
+ abot.y = this.y + 216; // 764 - 740
256
+ abot.zIndex = this.zIndex - 10;
257
+
258
+ PlayState.instance.currentStage.add(abot);
281
259
282
260
abotViz.x = abot.x + 200;
283
261
abotViz.y = abot.y + 84;
262
+ abotViz.zIndex = abot.zIndex - 1;
263
+ PlayState.instance.currentStage.add(abotViz);
284
264
285
265
eyeWhites.x = abot.x + 40;
286
266
eyeWhites.y = abot.y + 250;
267
+ eyeWhites.zIndex = abot.zIndex - 10;
268
+ PlayState.instance.currentStage.add(eyeWhites);
287
269
288
270
pupil.x = abot.x - 507;
289
271
pupil.y = abot.y - 492;
272
+ pupil.zIndex = eyeWhites.zIndex + 5;
273
+ PlayState.instance.currentStage.add(pupil);
290
274
291
275
stereoBG.x = abot.x + 150;
292
276
stereoBG.y = abot.y + 30;
277
+ stereoBG.zIndex = abot.zIndex - 8;
278
+ PlayState.instance.currentStage.add(stereoBG);
293
279
280
+ PlayState.instance.currentStage.refresh();
294
281
refershedLol = true;
295
282
}
296
283
@@ -299,67 +286,14 @@ class NeneCharacter extends SparrowCharacter {
299
286
}
300
287
}
301
288
302
- override function draw() {
303
- if(!this.visible)
304
- return;
305
- eyeWhites.draw();
306
- stereoBG.draw();
307
- pupil.draw();
308
- if (analyzer != null) drawFFT();
309
- abotViz.draw();
310
- if(!(this.animation.curAnim.name == 'lowerKnife' && this.animation.curAnim.curFrame >= 10))
311
- abot.draw();
312
- super.draw();
313
- }
314
-
315
- var songStarted:Bool = false;
316
-
317
289
public function onScriptEvent(event:ScriptEvent):Void {
318
290
if (event.type == "SONG_START")
319
291
{
320
- initAnalyzer() ;
321
- songStarted = true ;
292
+ abotViz.snd = FlxG.sound.music ;
293
+ abotViz.initAnalyzer() ;
322
294
}
323
- if (event.type == "COUNTDOWN_START")
324
- songStarted = false;
325
295
}
326
296
327
- function drawFFT():Void
328
- {
329
- var levels = analyzer.getLevels();
330
-
331
- for (i in 0...Math.min(abotViz.members.length, levels.length - 1))
332
- {
333
- if (!songStarted)
334
- {
335
- abotViz.members[i].animation.curAnim.curFrame = abotViz.members[i].animation.curAnim.numFrames - 1;
336
- continue;
337
- }
338
-
339
- var animFrame:Int = Math.round(levels[i+1].value * 5);
340
-
341
- animFrame = Math.floor(Math.min(5, animFrame));
342
- animFrame = Math.floor(Math.max(0, animFrame));
343
-
344
- animFrame = Std.int(Math.abs(animFrame - 5)); // shitty dumbass flip, cuz dave got da shit backwards lol!
345
-
346
- abotViz.members[i].animation.curAnim.curFrame = animFrame;
347
- }
348
- }
349
-
350
- public function initAnalyzer()
351
- {
352
- analyzer = new SpectralAnalyzer(SoundUtil.getSoundChannelSource(FlxG.sound.music), 8, 0.1, 40);
353
-
354
- var platform:HostPlatform = PlatformUtil.detectHostPlatform();
355
-
356
- if (platform != HostPlatform.HTML5) {
357
- // On desktop it uses FFT stuff that isn't as optimized as the direct browser stuff we use on HTML5
358
- // So we want to manually change it!
359
- analyzer.fftN = 256;
360
- }
361
- }
362
-
363
297
var animationFinished:Bool = false;
364
298
365
299
function onAnimationFinished(name:String) {
0 commit comments