some cool stuff

This commit is contained in:
Yoshman29
2022-11-05 01:23:09 +01:00
parent 0719786f21
commit 1a9dfbaabc
7 changed files with 37 additions and 17 deletions
+8
View File
@@ -1,4 +1,12 @@
function create() {
importScript("data/scripts/pixel");
pixelNotesForBF = false;
}
function updatePost(elapsed) {
var sin = Math.sin(curBeatFloat * Math.PI / 2);
var cos = Math.cos(curBeatFloat * Math.PI / 2);
boyfriend.angle = sin * 15;
dad.angle = sin * -15;
}
+1 -1
View File
@@ -1 +1 @@
1106
1109
+5 -7
View File
@@ -81,7 +81,6 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
curCharacter = character;
this.isPlayer = isPlayer;
var tex:FlxAtlasFrames;
antialiasing = true;
while(true) {
@@ -117,7 +116,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
if (xml.has.flipX) flipX = (xml.att.flipX == "true");
if (xml.has.icon) icon = xml.att.icon;
frames = Paths.getSparrowAtlas('characters/$curCharacter');
frames = CoolUtil.loadFrames(Paths.image('characters/$curCharacter'));
for(anim in xml.nodes.anim) {
XMLUtil.addXMLAnimation(this, anim);
}
@@ -379,18 +378,17 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
script.call("onPlayAnim", [event]);
if (event.cancelled || event.animName == null) return;
if (event.cancelled || event.animName == null || !animation.exists(event.animName)) return;
animation.play(event.animName, event.force, event.reverse, event.startingFrame);
var daOffset = animOffsets.get(event.animName);
if (daOffset != null)
offset.set(daOffset.x * (isPlayer != playerOffsets ? -1 : 1), daOffset.y);
rotOffset.set(daOffset.x * (isPlayer != playerOffsets ? -1 : 1), daOffset.y);
else
offset.set(0, 0);
rotOffset.set(0, 0);
offset.x += globalOffset.x * (isPlayer != playerOffsets ? 1 : -1);
offset.y -= globalOffset.y;
offset.set(globalOffset.x * (isPlayer != playerOffsets ? 1 : -1), -globalOffset.y);
if (event.animName.startsWith("sing"))
lastHit = Conductor.songPosition;
+5 -2
View File
@@ -66,7 +66,9 @@ class Note extends FlxSprite
public static var swagWidth:Float = 160 * 0.7;
public function new(strumTime:Float, noteData:Int, noteType:Int = 0, mustPress:Bool = true, ?prevNote:Note, ?sustainNote:Bool = false)
public var animSuffix:String = "";
public function new(strumTime:Float, noteData:Int, noteType:Int = 0, mustPress:Bool = true, ?prevNote:Note, ?sustainNote:Bool = false, animSuffix:String = "")
{
super();
@@ -85,11 +87,12 @@ class Note extends FlxSprite
this.noteData = noteData;
var event = new NoteCreationEvent(this, strumID, this.noteType, noteTypeID, mustPress, "game/NOTE_assets", 0.7);
var event = new NoteCreationEvent(this, strumID, this.noteType, noteTypeID, mustPress, "game/NOTE_assets", 0.7, animSuffix);
if (PlayState.instance != null)
event = PlayState.instance.scripts.event("onNoteCreation", event);
this.animSuffix = event.animSuffix;
if (!event.cancelled) {
switch (event.noteType)
{
+5 -5
View File
@@ -477,7 +477,7 @@ class PlayState extends MusicBeatState
else
swagNote = null;
swagNote.nextNote = (swagNote = new Note(daStrumTime, daNoteData % 4, daNoteType, gottaHitNote, swagNote));
swagNote.nextNote = (swagNote = new Note(daStrumTime, daNoteData % 4, daNoteType, gottaHitNote, swagNote, false, section.altAnim ? "-alt" : ""));
swagNote.sustainLength = songNotes[2];
swagNote.scrollFactor.set(0, 0);
swagNote.stepLength = stepCrochet;
@@ -490,7 +490,7 @@ class PlayState extends MusicBeatState
// create sustains
for (susNote in 0...Math.floor(susLength))
{
swagNote = new Note(daStrumTime + (stepCrochet * susNote), daNoteData % 4, daNoteType, gottaHitNote, swagNote, true);
swagNote = new Note(daStrumTime + (stepCrochet * susNote), daNoteData % 4, daNoteType, gottaHitNote, swagNote, true, section.altAnim ? "-alt" : "");
swagNote.scrollFactor.set();
swagNote.stepLength = stepCrochet;
notes.add(swagNote);
@@ -1302,9 +1302,9 @@ class PlayState extends MusicBeatState
var event:NoteHitEvent;
if (note.mustPress)
event = scripts.event("onPlayerHit", new NoteHitEvent(note, boyfriend, true, note.noteType, note.strumID, note.noteData > 0 ? 0.023 : 0.004));
event = scripts.event("onPlayerHit", new NoteHitEvent(note, boyfriend, true, note.noteType, note.strumID, note.noteData > 0 ? 0.023 : 0.004, note.animSuffix));
else
event = scripts.event("onDadHit", new NoteHitEvent(note, dad, false, note.noteType, note.strumID, 0));
event = scripts.event("onDadHit", new NoteHitEvent(note, dad, false, note.noteType, note.strumID, 0, note.animSuffix));
if (!event.cancelled) {
if (event.player && !note.isSustainNote)
@@ -1316,7 +1316,7 @@ class PlayState extends MusicBeatState
health += event.healthGain;
if (!event.animCancelled) {
event.character.playSingAnim(event.direction);
event.character.playSingAnim(event.direction, event.animSuffix);
}
(event.player ? playerStrums : cpuStrums).forEach(function(str:Strum) {
@@ -38,6 +38,11 @@ class NoteCreationEvent extends CancellableEvent {
*/
public var noteScale:Float;
/**
* Sing animation suffix. "-alt" for alt anim or "" for normal notes.
*/
public var animSuffix:String;
/**
* [Description] Creates a new NoteCreationEvent
* @param note
@@ -46,7 +51,7 @@ class NoteCreationEvent extends CancellableEvent {
* @param noteTypeID
* @param mustHit
*/
public function new(note:Note, strumID:Int, noteType:String, noteTypeID:Int, mustHit:Bool, noteSprite:String, noteScale:Float) {
public function new(note:Note, strumID:Int, noteType:String, noteTypeID:Int, mustHit:Bool, noteSprite:String, noteScale:Float, animSuffix:String) {
super();
this.note = note;
this.strumID = strumID;
@@ -55,5 +60,6 @@ class NoteCreationEvent extends CancellableEvent {
this.mustHit = mustHit;
this.noteSprite = noteSprite;
this.noteScale = noteScale;
this.animSuffix = animSuffix;
}
}
@@ -30,6 +30,10 @@ class NoteHitEvent extends CancellableEvent {
* Note Type name (null if default note)
*/
public var noteType:String;
/**
* Suffix of the animation. "-alt" for alt notes, "" for normal ones.
*/
public var animSuffix:String;
/**
* Direction of the press (0 = Left, 1 = Down, 2 = Up, 3 = Right)
*/
@@ -46,7 +50,7 @@ class NoteHitEvent extends CancellableEvent {
/**
* Creates a new NoteHitEvent.
*/
public function new(note:Note, character:Character, player:Bool, noteType:String, direction:Int, healthGain:Float, unmuteVocals:Bool = true, score:Int = 350) {
public function new(note:Note, character:Character, player:Bool, noteType:String, direction:Int, healthGain:Float, unmuteVocals:Bool = true, score:Int = 350, animSuffix:String = "") {
super();
this.note = note;
@@ -57,6 +61,7 @@ class NoteHitEvent extends CancellableEvent {
this.healthGain = healthGain;
this.unmuteVocals = unmuteVocals;
this.score = score;
this.animSuffix = animSuffix;
}
/**