limo stage

This commit is contained in:
Yoshman29
2022-10-08 16:08:20 +02:00
parent 253482c552
commit ec12222b07
97 changed files with 314 additions and 113 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="true" flipX="true" x="0" y="350">
<anim name="idle" anim="BF idle dance" fps="24" loop="false" x="-5" y="0"/>
<anim name="singUP" anim="BF NOTE UP0" fps="24" loop="false" x="-29" y="27"/>
<anim name="singLEFT" anim="BF NOTE LEFT0" fps="24" loop="false" x="12" y="-6"/>
<anim name="singRIGHT" anim="BF NOTE RIGHT0" fps="24" loop="false" x="-38" y="-7"/>
<anim name="singDOWN" anim="BF NOTE DOWN0" fps="24" loop="false" x="-10" y="-50"/>
<anim name="singUPmiss" anim="BF NOTE UP MISS" fps="24" loop="false" x="-29" y="27"/>
<anim name="singLEFTmiss" anim="BF NOTE LEFT MISS" fps="24" loop="false" x="12" y="24"/>
<anim name="singRIGHTmiss" anim="BF NOTE RIGHT MISS" fps="24" loop="false" x="-30" y="21"/>
<anim name="singDOWNmiss" anim="BF NOTE DOWN MISS" fps="24" loop="false" x="-11" y="-19"/>
<anim name="hey" anim="BF HEY" fps="24" loop="false" x="7" y="4"/>
</character>
+23
View File
@@ -0,0 +1,23 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="false" flipX="false" isGF="true">
<anim name="danceLeft" anim="GF Dancing Beat" fps="24" loop="false" x="0" y="-9" indices="30,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="GF Dancing Beat" fps="24" loop="false" x="0" y="-9" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</character>
<!-- if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
} -->
<!--
switch (curCharacter)
{
case 'gf':
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
playAnim('danceRight');
} -->
+29
View File
@@ -0,0 +1,29 @@
function create() {
resetFastCar();
}
function resetFastCar() {
fastCar.x = -12600;
fastCar.y = FlxG.random.int(140, 250);
fastCar.velocity.x = 0;
fastCarCanDrive = true;
}
function update(elapsed:Float) {
if (!fastCarCanDrive && fastCar.x > 2000) {
resetFastCar();
fastCarCanDrive = true;
}
}
function fastCarDrive()
{
FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7);
fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3;
fastCarCanDrive = false;
}
function beatHit(curBeat:Int) {
if (FlxG.random.bool(10) && fastCarCanDrive)
fastCarDrive();
}
+42
View File
@@ -0,0 +1,42 @@
<!DOCTYPE codename-engine-stage>
<stage zoom="0.9" name="limo" folder="stages/limo/">
<!-- BG LIMOS !-->
<sprite name="skyBG" x="-120" y="-50" sprite="limoSunset" scroll="0.1"/>
<sprite name="bgLimo" x="-200" y="480" sprite="bgLimo" scroll="0.4"/>
<!-- DANCERS !-->
<sprite name="dancer1" x="130" y="80" sprite="limoDancer" scroll="0.4">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer2" x="500" y="80" sprite="limoDancer" scroll="0.4">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer3" x="870" y="80" sprite="limoDancer" scroll="0.4">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer4" x="1240" y="80" sprite="limoDancer" scroll="0.4">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer5" x="1610" y="80" sprite="limoDancer" scroll="0.4">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<!-- SUPER FAST CAR !-->
<sprite name="fastCar" x="-300" y="160" sprite="fastCarLol" />
<!-- MORE LIMO STUFF !-->
<sprite name="overlayShit" x="-500" y="480" sprite="limoOverlay" scroll="0">
<property name="alpha" type="float" value="0.5" />
<property name="blend" type="string" value="multiply" />
</sprite>
<girlfriend />
<sprite name="limo" x="-120" y="550" sprite="limoDrive" anim="drive">
<anim name="drive" anim="Limo stage"/>
</sprite>
<boyfriend x="1030" y="-120" />
</stage>

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Before

Width:  |  Height:  |  Size: 839 KiB

After

Width:  |  Height:  |  Size: 839 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 303 KiB

Before

Width:  |  Height:  |  Size: 628 KiB

After

Width:  |  Height:  |  Size: 628 KiB

Before

Width:  |  Height:  |  Size: 593 KiB

After

Width:  |  Height:  |  Size: 593 KiB

Before

Width:  |  Height:  |  Size: 924 KiB

After

Width:  |  Height:  |  Size: 924 KiB

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

+1 -1
View File
@@ -1 +1 @@
227
234
+3 -2
View File
@@ -3,6 +3,7 @@ package funkin.game;
import flixel.math.FlxPoint;
import funkin.interfaces.IBeatReceiver;
import funkin.interfaces.IOffsetCompatible;
import funkin.system.XMLUtil;
import flixel.FlxG;
import flixel.FlxSprite;
@@ -96,7 +97,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
frames = Paths.getSparrowAtlas('characters/$curCharacter');
for(anim in character.nodes.anim) {
CoolUtil.addXMLAnimation(this, anim);
XMLUtil.addXMLAnimation(this, anim);
}
}
break;
@@ -686,7 +687,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
else
offset.set(0, 0);
offset.x += globalOffset.x - (isPlayer != playerOffsets ? 1 : -1);
offset.x += globalOffset.x * (isPlayer != playerOffsets ? 1 : -1);
offset.y -= globalOffset.y;
if (AnimName.startsWith("sing"))
+38 -4
View File
@@ -1,13 +1,17 @@
package funkin.game;
import funkin.system.XMLUtil;
import flixel.FlxSprite;
import openfl.utils.Assets;
import haxe.xml.Access;
import flixel.FlxBasic;
import flixel.math.FlxMath;
import funkin.interfaces.IBeatReceiver;
import funkin.scripting.Script;
import haxe.io.Path;
using StringTools;
class Stage extends FlxBasic implements IBeatReceiver {
public var stageXML:Access;
public var stagePath:String;
@@ -42,13 +46,13 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (stageXML.has.name) PlayState.instance.curStage = stageXML.att.name;
for(node in stageXML.elements) {
switch(node.name) {
var sprite:Dynamic = switch(node.name) {
case "sprite" | "spr" | "sparrow":
var spr = new FlxSprite();
var spr = new StageSprite();
spr.antialiasing = true;
if (!node.has.sprite || !node.has.name || !node.has.x || !node.has.y) continue;
if (Assets.exists(Paths.file('images/$spritesParentFolder${node.att.sprite}', TEXT))) {
if (Assets.exists(Paths.file('images/$spritesParentFolder${node.att.sprite}.xml', TEXT))) {
spr.frames = Paths.getSparrowAtlas('$spritesParentFolder${node.att.sprite}');
} else {
spr.loadGraphic(Paths.image('$spritesParentFolder${node.att.sprite}'));
@@ -66,11 +70,17 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (scale != null) spr.scale.set(scale, scale);
}
if (node.has.updateHitbox && node.att.updateHitbox == "true") spr.updateHitbox();
for(anim in node.nodes.anim) {
if (anim.has.name) spr.beatAnims.push(anim.att.name);
XMLUtil.addXMLAnimation(spr, anim);
}
if (node.has.beatAnim && node.att.beatAnim.trim() != "") spr.beatAnims = [for(e in node.att.beatAnim.split(",")) e.trim()];
for(anim in node.nodes.anim) CoolUtil.addXMLAnimation(spr, anim);
stageSprites.set(node.att.name, spr);
PlayState.instance.add(spr);
spr;
case "boyfriend" | "bf":
if (node.has.x) {
var x:Null<Float> = Std.parseFloat(node.att.x);
@@ -81,6 +91,7 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (y != null) PlayState.instance.boyfriend.y = y;
}
PlayState.instance.add(PlayState.instance.boyfriend);
PlayState.instance.boyfriend;
case "girlfriend" | "gf":
if (node.has.x) {
var x:Null<Float> = Std.parseFloat(node.att.x);
@@ -91,6 +102,7 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (y != null) PlayState.instance.gf.y = y;
}
PlayState.instance.add(PlayState.instance.gf);
PlayState.instance.gf;
case "dad" | "opponent":
if (node.has.x) {
var x:Null<Float> = Std.parseFloat(node.att.x);
@@ -101,6 +113,13 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (y != null) PlayState.instance.dad.y = y;
}
PlayState.instance.add(PlayState.instance.dad);
PlayState.instance.dad;
default: null;
}
if (sprite != null) {
for(e in node.nodes.property) {
trace(XMLUtil.applyXMLProperty(sprite, e));
}
}
}
}
@@ -114,4 +133,19 @@ class Stage extends FlxBasic implements IBeatReceiver {
public function beatHit(curBeat:Int) {}
public function stepHit(curStep:Int) {}
}
class StageSprite extends FlxSprite implements IBeatReceiver {
public var beatAnims:Array<String> = [];
public override function update(elapsed:Float) {
super.update(elapsed);
}
public function beatHit(curBeat:Int) {
if (beatAnims.length > 0)
animation.play(beatAnims[FlxMath.wrap(curBeat, 0, beatAnims.length-1)]);
}
public function stepHit(curBeat:Int) {}
}
+1 -1
View File
@@ -64,7 +64,7 @@ class FreeplayState extends MusicBeatState
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
addWeek(['Pico', 'Philly Nice', 'Blammed'], 3, ['pico']);
addWeek(['Satin Panties', 'High', 'Milf'], 4, ['mom']);
addWeek(['Cocoa', 'Eggnog', 'Winter Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster']);
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
+1 -1
View File
@@ -33,7 +33,7 @@ class HScript extends Script {
}
public override function onLoad() {
interp.execute(expr);
if (expr != null) interp.execute(expr);
}
private override function onCall(funcName:String, parameters:Array<Dynamic>):Dynamic {
-50
View File
@@ -1,52 +1,12 @@
package funkin.system;
import funkin.interfaces.IOffsetCompatible;
import lime.utils.Assets;
import flixel.animation.FlxAnimation;
import haxe.xml.Access;
import flixel.FlxSprite;
using StringTools;
class CoolUtil
{
public static function addXMLAnimation(sprite:FlxSprite, anim:Access) {
var animData:AnimData = {
name: null,
anim: null,
fps: 24,
loop: false,
x: 0,
y: 0,
indices: []
};
if (anim.has.name) animData.name = anim.att.name;
if (anim.has.anim) animData.anim = anim.att.anim;
if (anim.has.fps) animData.fps = Std.parseInt(anim.att.fps);
if (anim.has.x) animData.x = Std.parseFloat(anim.att.x);
if (anim.has.y) animData.y = Std.parseFloat(anim.att.y);
if (anim.has.indices) {
var indicesSplit = anim.att.indices.split(",");
for(indice in indicesSplit) {
var i = Std.parseInt(indice.trim());
if (i != null)
animData.indices.push(i);
}
}
if (animData.name != null && animData.anim != null) {
if (animData.fps <= 0 #if web || animData.fps == null #end) animData.fps = 24;
if (animData.indices.length > 0)
sprite.animation.addByIndices(animData.name, animData.anim, animData.indices, "", animData.fps, animData.loop);
else
sprite.animation.addByPrefix(animData.name, animData.anim, animData.fps, animData.loop);
if (sprite is IOffsetCompatible)
cast(sprite, IOffsetCompatible).addOffset(animData.name, animData.x, animData.y);
}
}
public static var difficultyArray:Array<String> = ['EASY', "NORMAL", "HARD"];
public static function difficultyString():String
@@ -70,14 +30,4 @@ class CoolUtil
anim1.frames = anim2.frames;
anim2.frames = old;
}
}
typedef AnimData = {
var name:String;
var anim:String;
var fps:Int;
var loop:Bool;
var x:Float;
var y:Float;
var indices:Array<Int>;
}
+11
View File
@@ -0,0 +1,11 @@
package funkin.system;
@:enum
abstract ErrorCode(Int) {
var OK = 0;
var FAILED = 1;
var MISSING_PROPERTY = 2;
var TYPE_INCORRECT = 3;
var VALUE_NULL = 4;
var REFLECT_ERROR = 5;
}
+98
View File
@@ -0,0 +1,98 @@
package funkin.system;
import haxe.xml.Access;
import funkin.interfaces.IOffsetCompatible;
import flixel.FlxSprite;
using StringTools;
/**
* Class made to make XML parsing easier.
*/
class XMLUtil {
/**
* Applies a property XML node to an object.
* @param object Object to which the xml property will be applied
* @param property `property` node.
*/
public static function applyXMLProperty(object:Dynamic, property:Access):ErrorCode {
if (!property.has.name || !property.has.type || !property.has.value) {
// TODO: show in logs
return MISSING_PROPERTY;
}
var value:Dynamic = switch(property.att.type.toLowerCase()) {
case "float" | "number": Std.parseFloat(property.att.value);
case "int" | "integer": Std.parseInt(property.att.value);
case "string" | "str" | "text": property.att.value;
case "bool" | "boolean": property.att.value.toLowerCase() == "true";
default: return TYPE_INCORRECT;
}
if (value == null) return VALUE_NULL;
try {
Reflect.setProperty(object, property.att.name, value);
} catch(e) {
// TODO: Correct Logs
trace(e);
return REFLECT_ERROR;
}
return OK;
}
/**
* Adds an XML animation to `sprite`.
* @param sprite Destination sprite
* @param anim Animation (Must be a `anim` XML node)
*/
public static function addXMLAnimation(sprite:FlxSprite, anim:Access):ErrorCode {
var animData:AnimData = {
name: null,
anim: null,
fps: 24,
loop: false,
x: 0,
y: 0,
indices: []
};
if (anim.has.name) animData.name = anim.att.name;
if (anim.has.anim) animData.anim = anim.att.anim;
if (anim.has.fps) animData.fps = Std.parseInt(anim.att.fps);
if (anim.has.x) animData.x = Std.parseFloat(anim.att.x);
if (anim.has.y) animData.y = Std.parseFloat(anim.att.y);
if (anim.has.indices) {
var indicesSplit = anim.att.indices.split(",");
for(indice in indicesSplit) {
var i = Std.parseInt(indice.trim());
if (i != null)
animData.indices.push(i);
}
}
if (animData.name != null && animData.anim != null) {
if (animData.fps <= 0 #if web || animData.fps == null #end) animData.fps = 24;
if (animData.indices.length > 0)
sprite.animation.addByIndices(animData.name, animData.anim, animData.indices, "", animData.fps, animData.loop);
else
sprite.animation.addByPrefix(animData.name, animData.anim, animData.fps, animData.loop);
if (sprite is IOffsetCompatible)
cast(sprite, IOffsetCompatible).addOffset(animData.name, animData.x, animData.y);
return OK;
}
return MISSING_PROPERTY;
}
}
typedef AnimData = {
var name:String;
var anim:String;
var fps:Int;
var loop:Bool;
var x:Float;
var y:Float;
var indices:Array<Int>;
}