notes in da house

This commit is contained in:
Cameron Taylor 2020-10-04 01:38:21 -07:00
parent 0839f21e71
commit 86aba3f004
5 changed files with 165 additions and 27 deletions

View File

@ -1,3 +1,4 @@
wanda
fizzd
kiddbrute
kiddbrute
HenryEYES

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 700 KiB

View File

@ -2,20 +2,52 @@
<TextureAtlas imagePath="NOTE_assets.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="arrow static instance 10000" x="0" y="158" width="155" height="158"/>
<SubTexture name="arrow static instance 20000" x="0" y="316" width="157" height="155"/>
<SubTexture name="arrow static instance 30000" x="155" y="0" width="155" height="157"/>
<SubTexture name="arrow static instance 40000" x="313" y="154" width="157" height="154"/>
<SubTexture name="blue hold end instance 10000" x="208" y="375" width="51" height="64"/>
<SubTexture name="blue hold piece instance 10000" x="259" y="375" width="51" height="44"/>
<SubTexture name="blue instance 10000" x="155" y="157" width="158" height="154"/>
<SubTexture name="green hold end instance 10000" x="259" y="311" width="51" height="64"/>
<SubTexture name="green hold piece instance 10000" x="157" y="420" width="51" height="44"/>
<SubTexture name="green instance 10000" x="310" y="0" width="157" height="154"/>
<SubTexture name="pruple end hold instance 10000" x="157" y="311" width="51" height="65"/>
<SubTexture name="purple hold piece instance 10000" x="259" y="419" width="51" height="44"/>
<SubTexture name="purple instance 10000" x="0" y="0" width="155" height="158"/>
<SubTexture name="red hold end instance 10000" x="208" y="311" width="51" height="64"/>
<SubTexture name="red hold piece instance 10000" x="157" y="376" width="51" height="44"/>
<SubTexture name="red instance 10000" x="313" y="308" width="154" height="157"/>
<SubTexture name="arrowDOWN0000" x="0" y="235" width="157" height="153"/>
<SubTexture name="arrowLEFT0000" x="310" y="235" width="153" height="157"/>
<SubTexture name="arrowRIGHT0000" x="157" y="235" width="153" height="157"/>
<SubTexture name="arrowUP0000" x="784" y="232" width="157" height="153"/>
<SubTexture name="blue0000" x="1850" y="154" width="157" height="154"/>
<SubTexture name="blue hold end0000" x="1170" y="447" width="50" height="64"/>
<SubTexture name="blue hold piece0000" x="1370" y="449" width="50" height="44"/>
<SubTexture name="down confirm0000" x="0" y="0" width="238" height="235"/>
<SubTexture name="down confirm0001" x="238" y="0" width="238" height="235"/>
<SubTexture name="down confirm0002" x="1176" y="230" width="220" height="217" frameX="-6" frameY="-12" frameWidth="238" frameHeight="235"/>
<SubTexture name="down confirm0003" x="1176" y="230" width="220" height="217" frameX="-6" frameY="-12" frameWidth="238" frameHeight="235"/>
<SubTexture name="down press0000" x="149" y="392" width="142" height="140" frameX="-4" frameY="-2" frameWidth="149" frameHeight="146"/>
<SubTexture name="down press0001" x="149" y="392" width="142" height="140" frameX="-4" frameY="-2" frameWidth="149" frameHeight="146"/>
<SubTexture name="down press0002" x="0" y="388" width="149" height="146"/>
<SubTexture name="down press0003" x="0" y="388" width="149" height="146"/>
<SubTexture name="green0000" x="1850" y="0" width="157" height="154"/>
<SubTexture name="green hold end0000" x="1120" y="442" width="50" height="64"/>
<SubTexture name="green hold piece0000" x="1320" y="447" width="50" height="44"/>
<SubTexture name="left confirm0000" x="948" y="0" width="228" height="231"/>
<SubTexture name="left confirm0001" x="1402" y="228" width="218" height="221" frameX="-5" frameY="-5" frameWidth="228" frameHeight="231"/>
<SubTexture name="left confirm0002" x="1402" y="0" width="225" height="228" frameX="-2" frameY="-1" frameWidth="228" frameHeight="231"/>
<SubTexture name="left confirm0003" x="1402" y="0" width="225" height="228" frameX="-2" frameY="-1" frameWidth="228" frameHeight="231"/>
<SubTexture name="left press0000" x="291" y="392" width="140" height="142" frameX="-3" frameY="-3" frameWidth="146" frameHeight="149"/>
<SubTexture name="left press0001" x="291" y="392" width="140" height="142" frameX="-3" frameY="-3" frameWidth="146" frameHeight="149"/>
<SubTexture name="left press0002" x="463" y="389" width="146" height="149"/>
<SubTexture name="left press0003" x="463" y="389" width="146" height="149"/>
<SubTexture name="pruple end hold0000" x="1220" y="447" width="50" height="64"/>
<SubTexture name="purple0000" x="630" y="232" width="154" height="157"/>
<SubTexture name="purple hold piece0000" x="1420" y="449" width="50" height="44"/>
<SubTexture name="red0000" x="476" y="232" width="154" height="157"/>
<SubTexture name="red hold end0000" x="1070" y="442" width="50" height="64"/>
<SubTexture name="red hold piece0000" x="1270" y="447" width="50" height="44"/>
<SubTexture name="right confirm0000" x="1627" y="0" width="223" height="226" frameX="-1" frameY="-3" frameWidth="226" frameHeight="230"/>
<SubTexture name="right confirm0001" x="1627" y="226" width="223" height="226" frameX="-1" frameY="-3" frameWidth="226" frameHeight="230"/>
<SubTexture name="right confirm0002" x="1176" y="0" width="226" height="230"/>
<SubTexture name="right confirm0003" x="1176" y="0" width="226" height="230"/>
<SubTexture name="right press0000" x="932" y="442" width="138" height="141" frameX="-3" frameY="-7" frameWidth="148" frameHeight="151"/>
<SubTexture name="right press0001" x="932" y="442" width="138" height="141" frameX="-3" frameY="-7" frameWidth="148" frameHeight="151"/>
<SubTexture name="right press0002" x="784" y="385" width="148" height="151"/>
<SubTexture name="right press0003" x="784" y="385" width="148" height="151"/>
<SubTexture name="up confirm0000" x="476" y="0" width="236" height="232"/>
<SubTexture name="up confirm0001" x="712" y="0" width="236" height="232"/>
<SubTexture name="up confirm0002" x="948" y="231" width="214" height="211" frameX="-11" frameY="-10" frameWidth="236" frameHeight="232"/>
<SubTexture name="up confirm0003" x="948" y="231" width="214" height="211" frameX="-11" frameY="-10" frameWidth="236" frameHeight="232"/>
<SubTexture name="up press0000" x="609" y="389" width="144" height="141" frameX="-5" frameY="-4" frameWidth="153" frameHeight="150"/>
<SubTexture name="up press0001" x="609" y="389" width="144" height="141" frameX="-5" frameY="-4" frameWidth="153" frameHeight="150"/>
<SubTexture name="up press0002" x="1850" y="308" width="153" height="150"/>
<SubTexture name="up press0003" x="1850" y="308" width="153" height="150"/>
</TextureAtlas>

View File

@ -17,34 +17,41 @@ class Note extends FlxSprite
public var noteScore:Float = 1;
public static var swagWidth:Float = 160 * 0.7;
public function new(strumTime:Float, noteData:Int)
{
super();
x += 100;
x += 50;
this.strumTime = strumTime;
this.noteData = noteData;
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.NOTE_assets__png, AssetPaths.NOTE_assets__xml);
frames = tex;
animation.addByPrefix('greenScroll', 'green0');
animation.addByPrefix('redScroll', 'red0');
animation.addByPrefix('blueScroll', 'blue0');
animation.addByPrefix('purpleScroll', 'purple0');
var swagWidth:Float = 55;
setGraphicSize(Std.int(width * 0.7));
updateHitbox();
switch (Math.abs(noteData))
{
case 1:
x += swagWidth * 2;
color = FlxColor.GREEN;
animation.play('greenScroll');
case 2:
x += swagWidth * 3;
color = FlxColor.RED;
animation.play('redScroll');
case 3:
x += swagWidth * 1;
color = FlxColor.BLUE;
animation.play('blueScroll');
case 4:
x += swagWidth * 0;
color = FlxColor.PURPLE;
animation.play('purpleScroll');
}
if (noteData < 0)

View File

@ -4,6 +4,7 @@ import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.graphics.atlas.FlxAtlas;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.system.FlxSound;
@ -42,6 +43,8 @@ class PlayState extends FlxState
private var sectionScores:Array<Dynamic> = [[], []];
private var camFollow:FlxObject;
private var strumLineNotes:FlxTypedGroup<FlxSprite>;
private var playerStrums:FlxTypedGroup<FlxSprite>;
override public function create()
{
@ -68,13 +71,19 @@ class PlayState extends FlxState
boyfriend.animation.play('idle');
add(boyfriend);
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
strumLine.scrollFactor.set();
strumLineNotes = new FlxTypedGroup<FlxSprite>();
add(strumLineNotes);
playerStrums = new FlxTypedGroup<FlxSprite>();
generateSong('assets/data/bopeebo/bopeebo.json');
canHitText = new FlxText(10, 10, 0, "weed");
strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10);
strumLine.scrollFactor.set();
add(strumLine);
// add(strumLine);
camFollow = new FlxObject(0, 0, 1, 1);
add(camFollow);
@ -85,6 +94,8 @@ class PlayState extends FlxState
FlxG.worldBounds.set(0, 0, FlxG.width, FlxG.height);
FlxG.fixedTimestep = false;
super.create();
}
@ -94,6 +105,9 @@ class PlayState extends FlxState
{
// FlxG.log.add(ChartParser.parse());
generateStaticArrows(0);
generateStaticArrows(1);
var songData = Json.parse(Assets.getText(dataPath));
FlxG.sound.playMusic("assets/music/" + songData.song + "_Inst.mp3");
@ -165,6 +179,58 @@ class PlayState extends FlxState
}
}
private function generateStaticArrows(player:Int):Void
{
for (i in 0...4)
{
FlxG.log.add(i);
var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y);
var arrTex = FlxAtlasFrames.fromSparrow(AssetPaths.NOTE_assets__png, AssetPaths.NOTE_assets__xml);
babyArrow.frames = arrTex;
babyArrow.animation.addByPrefix('green', 'arrowUP');
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
babyArrow.scrollFactor.set();
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
babyArrow.updateHitbox();
babyArrow.ID = i + 1;
if (player == 1)
{
playerStrums.add(babyArrow);
}
switch (Math.abs(i + 1))
{
case 1:
babyArrow.x += Note.swagWidth * 2;
babyArrow.animation.addByPrefix('static', 'arrowUP');
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
case 2:
babyArrow.x += Note.swagWidth * 3;
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
case 3:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
case 4:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
}
babyArrow.animation.play('static');
babyArrow.x += 50;
babyArrow.x += ((FlxG.width / 2) * player);
strumLineNotes.add(babyArrow);
}
}
var sectionScored:Bool = false;
override public function update(elapsed:Float)
@ -242,7 +308,7 @@ class PlayState extends FlxState
daNote.kill();
}
daNote.y = (strumLine.y + 5 - (daNote.height / 2)) - ((Conductor.songPosition - daNote.strumTime) * 0.4);
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
});
keyShit();
@ -283,6 +349,38 @@ class PlayState extends FlxState
var downP = FlxG.keys.anyJustPressed([S, DOWN]);
var leftP = FlxG.keys.anyJustPressed([A, LEFT]);
var upR = FlxG.keys.anyJustReleased([W, UP]);
var rightR = FlxG.keys.anyJustReleased([D, RIGHT]);
var downR = FlxG.keys.anyJustReleased([S, DOWN]);
var leftR = FlxG.keys.anyJustReleased([A, LEFT]);
playerStrums.forEach(function(spr:FlxSprite)
{
switch (spr.ID)
{
case 1:
if (upP)
spr.animation.play('pressed');
if (upR)
spr.animation.play('static');
case 2:
if (rightP)
spr.animation.play('pressed');
if (rightR)
spr.animation.play('static');
case 3:
if (downP)
spr.animation.play('pressed');
if (downR)
spr.animation.play('static');
case 4:
if (leftP)
spr.animation.play('pressed');
if (leftR)
spr.animation.play('static');
}
});
if (up || right || down || left)
{
notes.forEach(function(daNote:Note)