week 6 have started development
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package funkin.game;
|
||||
|
||||
import flixel.FlxCamera;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.math.FlxMath;
|
||||
@@ -55,6 +56,9 @@ class Note extends FlxSprite
|
||||
public var noteAngle:Null<Float> = null;
|
||||
|
||||
public var noteType(get, null):String;
|
||||
|
||||
@:dox(hide) public var __strumCameras:Array<FlxCamera> = null;
|
||||
|
||||
private function get_noteType() {
|
||||
return PlayState.instance.getNoteType(noteTypeID);
|
||||
}
|
||||
@@ -117,7 +121,6 @@ class Note extends FlxSprite
|
||||
}
|
||||
}
|
||||
|
||||
animation.play("scroll");
|
||||
|
||||
if (isSustainNote && prevNote != null)
|
||||
{
|
||||
@@ -131,6 +134,8 @@ class Note extends FlxSprite
|
||||
prevNote.nextSustain = this;
|
||||
prevNote.animation.play('hold');
|
||||
}
|
||||
} else {
|
||||
animation.play("scroll");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +143,9 @@ class Note extends FlxSprite
|
||||
public var angleOffsets:Bool = true;
|
||||
|
||||
override function draw() {
|
||||
@:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras;
|
||||
@:privateAccess if (__strumCameras != null) FlxCamera._defaultCameras = __strumCameras;
|
||||
|
||||
var negativeScroll = isSustainNote && nextSustain != null && lastScrollSpeed < 0;
|
||||
if (negativeScroll) offset.y *= -1;
|
||||
|
||||
@@ -183,6 +191,7 @@ class Note extends FlxSprite
|
||||
}
|
||||
super.draw();
|
||||
if (negativeScroll) offset.y *= -1;
|
||||
@:privateAccess FlxCamera._defaultCameras = oldDefaultCameras;
|
||||
}
|
||||
|
||||
// The * 0.5 is so that it's easier to hit them too late, instead of too early
|
||||
|
||||
@@ -300,9 +300,9 @@ class PlayState extends MusicBeatState
|
||||
add(icon);
|
||||
}
|
||||
|
||||
scoreTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Score:0", 20);
|
||||
missesTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Misses:0", 20);
|
||||
accuracyTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Accuracy:-%", 20);
|
||||
scoreTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Score:0", 16);
|
||||
missesTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Misses:0", 16);
|
||||
accuracyTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Accuracy:-%", 16);
|
||||
|
||||
for(text in [scoreTxt, missesTxt, accuracyTxt]) {
|
||||
text.scrollFactor.set();
|
||||
@@ -1236,9 +1236,11 @@ class PlayState extends MusicBeatState
|
||||
});
|
||||
}
|
||||
|
||||
notes.forEachAlive(function(note:Note) {
|
||||
for(e in funcsToExec) e(note);
|
||||
});
|
||||
if (funcsToExec.length > 0) {
|
||||
notes.forEachAlive(function(note:Note) {
|
||||
for(e in funcsToExec) e(note);
|
||||
});
|
||||
}
|
||||
|
||||
for(e in notePerStrum) if (e != null) goodNoteHit(e);
|
||||
for(e in additionalNotes) goodNoteHit(e);
|
||||
@@ -1326,6 +1328,12 @@ class PlayState extends MusicBeatState
|
||||
|
||||
if (event.unmuteVocals) vocals.volume = 1;
|
||||
if (event.enableCamZooming) camZooming = true;
|
||||
if (event.autoHitLastSustain) {
|
||||
if (note.nextSustain != null && note.nextSustain.nextSustain == null) {
|
||||
// its a tail!!
|
||||
note.wasGoodHit = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.deleteNote && !note.isSustainNote) deleteNote(note);
|
||||
}
|
||||
|
||||
+15
-10
@@ -1,9 +1,10 @@
|
||||
package funkin.game;
|
||||
|
||||
import funkin.options.Options;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxCamera;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.math.FlxPoint;
|
||||
import funkin.options.Options;
|
||||
import funkin.system.Conductor;
|
||||
|
||||
class Strum extends FlxSprite {
|
||||
@@ -12,8 +13,9 @@ class Strum extends FlxSprite {
|
||||
|
||||
public var scrollSpeed:Null<Float> = null; // custom scroll speed per strum
|
||||
public var noteAngle:Null<Float> = null; // custom scroll speed per strum
|
||||
public var downscroll:Null<Bool> = false; // custom downscroll per strum
|
||||
|
||||
public var lastDrawCameras(default, null):Array<FlxCamera> = [];
|
||||
|
||||
public function getScrollSpeed(?note:Note) {
|
||||
if (note != null && note.scrollSpeed != null) return note.scrollSpeed;
|
||||
if (scrollSpeed != null) return scrollSpeed;
|
||||
@@ -26,12 +28,6 @@ class Strum extends FlxSprite {
|
||||
if (noteAngle != null) return noteAngle;
|
||||
return angle;
|
||||
}
|
||||
|
||||
public function getDownscroll() {
|
||||
if (downscroll != null) return downscroll;
|
||||
if (PlayState.instance != null) return PlayState.instance.downscroll;
|
||||
return Options.downscroll;
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
@@ -42,14 +38,23 @@ class Strum extends FlxSprite {
|
||||
}
|
||||
}
|
||||
|
||||
public override function draw() {
|
||||
lastDrawCameras = [for(c in cameras) c];
|
||||
super.draw();
|
||||
}
|
||||
|
||||
public function updateNotePosition(daNote:Note) {
|
||||
if (!daNote.exists) return;
|
||||
|
||||
var offset = FlxPoint.get(daNote.isSustainNote ? ((Note.swagWidth - daNote.width) / 2) : 0, (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(getScrollSpeed(daNote), 2)));
|
||||
var realOffset = FlxPoint.get(0, 0);
|
||||
|
||||
daNote.__strumCameras = lastDrawCameras;
|
||||
|
||||
if (daNote.isSustainNote) offset.y -= Note.swagWidth / 2;
|
||||
|
||||
daNote.scrollFactor.set(scrollFactor.x, scrollFactor.y);
|
||||
|
||||
var noteAngle = getNotesAngle(daNote);
|
||||
daNote.angle = daNote.isSustainNote ? noteAngle : angle;
|
||||
if (Std.int(noteAngle % 360) != 0) {
|
||||
@@ -61,8 +66,8 @@ class Strum extends FlxSprite {
|
||||
realOffset.x = offset.x;
|
||||
realOffset.y = offset.y;
|
||||
}
|
||||
if (!downscroll)
|
||||
realOffset.y *= -1;
|
||||
realOffset.y *= -1;
|
||||
|
||||
daNote.setPosition(x + realOffset.x, y + realOffset.y);
|
||||
|
||||
offset.put();
|
||||
|
||||
@@ -14,6 +14,22 @@ class ScriptPack extends Script {
|
||||
}
|
||||
}
|
||||
|
||||
public function new(name:String) {
|
||||
additionalDefaultVariables["importScript"] = importScript;
|
||||
super(name);
|
||||
}
|
||||
|
||||
public function importScript(path:String):Script {
|
||||
var script = Script.create(Paths.script(path));
|
||||
if (script is DummyScript) {
|
||||
throw 'Script at ${path} does not exist.';
|
||||
return null;
|
||||
}
|
||||
add(script);
|
||||
script.load();
|
||||
return script;
|
||||
}
|
||||
|
||||
public override function call(func:String, ?parameters:Array<Dynamic>):Dynamic {
|
||||
for(e in scripts)
|
||||
e.call(func, parameters);
|
||||
|
||||
@@ -8,6 +8,7 @@ class NoteHitEvent extends CancellableEvent {
|
||||
@:dox(hide) public var deleteNote:Bool = true;
|
||||
@:dox(hide) public var unmuteVocals:Bool = true;
|
||||
@:dox(hide) public var enableCamZooming:Bool = true;
|
||||
@:dox(hide) public var autoHitLastSustain:Bool = true;
|
||||
|
||||
/**
|
||||
Whenever a miss should be added.
|
||||
@@ -103,4 +104,13 @@ class NoteHitEvent extends CancellableEvent {
|
||||
}
|
||||
@:dox(hide)
|
||||
public function cancelCamZooming() {preventCamZooming();}
|
||||
|
||||
/**
|
||||
* Prevents the sustain tail (the last one) from being automatically hit when the sustain before it is hit.
|
||||
*/
|
||||
public function preventLastSustainHit() {
|
||||
autoHitLastSustain = false;
|
||||
}
|
||||
@:dox(hide)
|
||||
public function cancelLastSustainHit() {preventLastSustainHit();}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ class Logs {
|
||||
case WARNING: logText(' WARNING ', DARKYELLOW);
|
||||
case ERROR: logText(' ERROR ', DARKRED);
|
||||
case TRACE: logText(' TRACE ', GRAY);
|
||||
case VERBOSE: logText(' VERBOSE ', DARKMAGENTA);
|
||||
default: logText(' INFORMATION ', CYAN);
|
||||
},
|
||||
logText('] ')
|
||||
@@ -98,6 +99,7 @@ enum abstract Level(Int) {
|
||||
var WARNING = 1;
|
||||
var ERROR = 2;
|
||||
var TRACE = 3;
|
||||
var VERBOSE = 4;
|
||||
}
|
||||
typedef LogText = {
|
||||
var text:String;
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package lime.utils;
|
||||
|
||||
import haxe.PosInfos;
|
||||
import funkin.system.Logs as FunkinLogs;
|
||||
|
||||
#if !lime_debug
|
||||
@:fileXml('tags="haxe,release"')
|
||||
@:noDebug
|
||||
#end
|
||||
class Log
|
||||
{
|
||||
public static var level:LogLevel;
|
||||
|
||||
public static function debug(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.DEBUG)
|
||||
{
|
||||
#if js
|
||||
untyped __js__("console").debug("[" + info.className + "] " + message);
|
||||
#else
|
||||
println("[" + info.className + "] " + Std.string(message));
|
||||
#end
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function error(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.ERROR)
|
||||
{
|
||||
var message = '[${info.className}] $message';
|
||||
|
||||
FunkinLogs.trace(message, ERROR, RED);
|
||||
}
|
||||
}
|
||||
|
||||
public static function info(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.INFO)
|
||||
FunkinLogs.trace('[${info.className}] $message', INFO, RED);
|
||||
}
|
||||
|
||||
public static inline function print(message:Dynamic):Void
|
||||
{
|
||||
#if sys
|
||||
Sys.print(Std.string(message));
|
||||
#elseif flash
|
||||
untyped __global__["trace"](Std.string(message));
|
||||
#elseif js
|
||||
untyped __js__("console").log(message);
|
||||
#else
|
||||
trace(message);
|
||||
#end
|
||||
}
|
||||
|
||||
public static inline function println(message:Dynamic):Void
|
||||
{
|
||||
#if sys
|
||||
Sys.println(Std.string(message));
|
||||
#elseif flash
|
||||
untyped __global__["trace"](Std.string(message));
|
||||
#elseif js
|
||||
untyped __js__("console").log(message);
|
||||
#else
|
||||
trace(Std.string(message));
|
||||
#end
|
||||
}
|
||||
|
||||
public static function verbose(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.VERBOSE)
|
||||
FunkinLogs.trace('[${info.className}] $message', VERBOSE);
|
||||
}
|
||||
|
||||
public static function warn(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.WARN)
|
||||
{
|
||||
FunkinLogs.trace('[${info.className}] $message', WARNING, YELLOW);
|
||||
}
|
||||
}
|
||||
|
||||
private static function __init__():Void
|
||||
{
|
||||
#if no_traces
|
||||
level = NONE;
|
||||
#elseif verbose
|
||||
level = VERBOSE;
|
||||
#else
|
||||
#if sys
|
||||
var args = Sys.args();
|
||||
if (args.indexOf("-v") > -1 || args.indexOf("-verbose") > -1)
|
||||
{
|
||||
level = VERBOSE;
|
||||
}
|
||||
else
|
||||
#end
|
||||
{
|
||||
#if debug
|
||||
level = DEBUG;
|
||||
#else
|
||||
level = INFO;
|
||||
#end
|
||||
}
|
||||
#end
|
||||
|
||||
#if js
|
||||
if (untyped __js__("typeof console") == "undefined")
|
||||
{
|
||||
untyped __js__("console = {}");
|
||||
}
|
||||
if (untyped __js__("console").log == null)
|
||||
{
|
||||
untyped __js__("console").log = function() {};
|
||||
}
|
||||
#end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user