charter progress

This commit is contained in:
Yoshman29
2023-03-20 14:58:14 +01:00
parent 2232d19fa2
commit 8f542c11e9
7 changed files with 22 additions and 65 deletions
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 21 KiB

-9
View File
@@ -1,9 +0,0 @@
#pragma header
uniform vec3 noteColor;
void main() {
vec4 finalColor = flixel_texture2D(bitmap, openfl_TextureCoordv);
float diff = finalColor.r - ((finalColor.g + finalColor.b) / 2.0);
gl_FragColor = vec4(((finalColor.g + finalColor.b) / 2.0) + (noteColor.r * diff), finalColor.g + (noteColor.g * diff), finalColor.b + (noteColor.b * diff), finalColor.a);
}
+1 -1
View File
@@ -1 +1 @@
2663
2673
+10 -1
View File
@@ -143,7 +143,7 @@ class Charter extends UIState {
gridBackdrop = new CharterBackdrop();
gridBackdrop.setPosition(0, 0);
// gridBackdrop.setPosition(-78, 1);
notesGroup.cameras = gridBackdrop.cameras = [charterCamera];
@@ -183,5 +183,14 @@ class Charter extends UIState {
// TODO: remove this bs!!
if (controls.BACK)
FlxG.switchState(new funkin.menus.MainMenuState());
if (controls.LEFT)
FlxG.camera.scroll.x -= 100 * elapsed;
if (controls.RIGHT)
FlxG.camera.scroll.x += 100 * elapsed;
if (controls.UP)
FlxG.camera.scroll.y -= 100 * elapsed;
if (controls.DOWN)
FlxG.camera.scroll.y += 100 * elapsed;
}
}
@@ -1,5 +1,6 @@
package funkin.editors.charter;
import openfl.geom.Rectangle;
import flixel.addons.display.FlxBackdrop;
class CharterBackdrop extends FlxBackdrop {
@@ -8,14 +9,14 @@ class CharterBackdrop extends FlxBackdrop {
public function new() {
super(null, 1, 1, false, true);
makeGraphic(4, 4, 0xFF272727, true);
makeGraphic(160, 160, 0xFF272727, true);
pixels.lock();
for(y in 0...4)
for(x in 0...2)
pixels.setPixel32((x*2)+(y%2), y, 0xFF545454);
pixels.fillRect(new Rectangle(40*((x*2)+(y%2)), 40*y, 40, 40), 0xFF545454);
pixels.fillRect(new Rectangle(0, 0, 1, 160), 0xFFDDDDDD);
pixels.fillRect(new Rectangle(159, 0, 1, 160), 0xFFDDDDDD);
pixels.unlock();
scale.set(40, 40);
updateHitbox();
loadFrame(frame);
}
+6 -50
View File
@@ -5,76 +5,32 @@ import funkin.shaders.CustomShader;
import flixel.util.FlxColor;
class CharterNote extends UISprite {
private static var colors:Array<FlxColor> = [
0xFFC24B99, // purple
0xFF00FFFF, // cyan
0xFF12FA05, // green
0xFFF9393F // red
];
private static var colorsRotation:Array<FlxColor>;
public static final noteScaleX:Float = 40 / 154;
public static final noteScaleY:Float = 40 / 157;
public var charterNoteShader:CustomShader;
var angleTween:FlxTween;
public function new() {
super();
antialiasing = true;
loadGraphic(Paths.image('editors/charter/note'));
scale.set(noteScaleX, noteScaleY);
updateHitbox();
scale.set(noteScaleY, noteScaleY);
shader = charterNoteShader = new CustomShader('engine/charterNote');
if (colorsRotation == null) colorsRotation = [
colors[2],
colors[3],
colors[1],
colors[0]
];
loadGraphic(Paths.image('editors/charter/note'), true, 157, 154);
animation.add("note", [for(i in 0...frames.frames.length) i], 0, true);
animation.play("note");
this.setUnstretchedGraphicSize(40, 40, false);
angle = 45; // green-red inbetween
}
private override function set_angle(v:Float):Float {
if (charterNoteShader != null) {
var v2:Float = v;
var o:Int = 0;
// make sure the note isnt negative
while(v2 < 0) {
v2 += 90;
o -= 1;
}
// make sure the note is under 90 degrees
while(v2 > 90) {
v2 -= 90;
o += 1;
}
var c:FlxColor = FlxColor.interpolate(colorsRotation[FlxMath.wrap(o, 0, 3)], colorsRotation[FlxMath.wrap(o+1, 0, 3)], v2 / 90);
charterNoteShader.hset('noteColor', [c.redFloat, c.greenFloat, c.blueFloat]);
}
return super.set_angle(v);
}
public function updatePos(step:Float, id:Int, susLength:Float = 0, type:Int = 0) {
x = id * 40;
y = step * 40;
if (angleTween != null) angleTween.cancel();
angleTween = FlxTween.tween(this, {angle: switch(id % 4) {
angleTween = FlxTween.tween(this, {angle: switch(animation.curAnim.curFrame = (id % 4)) {
case 0: -90;
case 1: 180;
case 2: 0;
case 3: 90;
default: 0; // how is that even possible
}}, 1, {ease: function(t) {
}}, 2/3, {ease: function(t) {
return ((Math.sin(t * Math.PI) * 0.35) * 3 * t * Math.sqrt(1 - t)) + t;
}});
}