Merge branch 'stable' of https://github.com/KadeDev/Kade-Engine into stable

This commit is contained in:
Kade M 2021-06-21 01:23:36 -07:00
commit ccd15546ea
105 changed files with 18524 additions and 683 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 254 KiB

View File

@ -112,6 +112,9 @@
<haxelib name="flixel-addons" />
<haxelib name="hscript" />
<haxelib name="actuate" />
<haxelib name="extension-webm"/> <!-- Make sure to use https://github.com/KadeDev/extension-webm/ -->
<!--In case you want to use the ui package-->
<haxelib name="flixel-ui" />
<haxelib name="newgrounds"/>

129
README.md
View File

@ -1,61 +1,68 @@
![Kade Engine logo](https://user-images.githubusercontent.com/26305836/110529589-4b4eb600-80ce-11eb-9c44-e899118b0bf0.png)
[![AppVeyor](https://img.shields.io/appveyor/build/KadeDev/Kade-Engine-Windows?label=windows%20build)](https://ci.appveyor.com/project/KadeDev/kade-engine-windows/build/artifacts) [![AppVeyor](https://img.shields.io/appveyor/build/KadeDev/Kade-Engine-Macos?label=macOS%20build)](https://ci.appveyor.com/project/KadeDev/kade-engine-macos/build/artifacts) [![AppVeyor](https://img.shields.io/appveyor/build/KadeDev/Kade-Engine-Linux?label=linux%20build)](https://ci.appveyor.com/project/KadeDev/kade-engine-linux/build/artifacts) [![AppVeyor](https://img.shields.io/appveyor/build/daniel11420/KadeEngineWeb?label=html5&20build)](https://ci.appveyor.com/project/daniel11420/KadeEngineWeb) [![Discord](https://img.shields.io/discord/808039740464300104?label=discord)](https://discord.gg/MG6GQFh52U) [![GitHub issues](https://img.shields.io/github/issues/KadeDev/Kade-Engine)](https://github.com/KadeDev/Kade-Engine/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/KadeDev/Kade-Engine)](https://github.com/KadeDev/Kade-Engine/pulls) []() []()
![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/KadeDev/Kade-Engine/latest) ![GitHub repo size](https://img.shields.io/github/repo-size/KadeDev/Kade-Engine) ![Lines of code](https://img.shields.io/tokei/lines/github/KadeDev/Kade-Engine) ![Supported platforms](https://img.shields.io/badge/supported%20platforms-windows%2C%20macOS%2C%20linux%2C%20html5-blue) ![GitHub all releases](https://img.shields.io/github/downloads/KadeDev/Kade-Engine/total) ![GitHub](https://img.shields.io/github/license/KadeDev/Kade-Engine) ![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/KadeDev/Kade-Engine?include_prereleases&label=latest%20version)
# Friday Night Funkin': Kade Engine
## Friday Night Funkin'
**Friday Night Funkin'** is a rhythm game originally made for Ludum Dare 47 "Stuck In a Loop".
Links: **[itch.io page](https://ninja-muffin24.itch.io/funkin) ⋅ [Newgrounds](https://www.newgrounds.com/portal/view/770371) ⋅ [source code on GitHub](https://github.com/ninjamuffin99/Funkin)**
> Uh oh! Your tryin to kiss ur hot girlfriend, but her MEAN and EVIL dad is trying to KILL you! He's an ex-rockstar, the only way to get to his heart? The power of music...
## Kade Engine
**Kade Engine** is a mod for Friday Night Funkin', including a full engine rework, replays, and more.
Links: **[GameBanana mod page](https://gamebanana.com/gamefiles/16761) ⋅ [play in browser](https://funkin.puyo.xyz) ⋅ [latest stable release](https://github.com/KadeDev/Kade-Engine/releases/latest) ⋅ [latest development build (windows)](https://ci.appveyor.com/project/KadeDev/kade-engine-windows/build/artifacts) ⋅ [latest development build (macOS)](https://ci.appveyor.com/project/KadeDev/kade-engine-macos/build/artifacts) ⋅ [latest development build (linux)](https://ci.appveyor.com/project/KadeDev/kade-engine-linux/build/artifacts)**
**REMEMBER**: This is a **mod**. This is not the vanilla game and should be treated as a **modification**. This is not and probably will never be official, so don't get confused.
## Website ([KadeDev.github.io/kade-engine/](https://KadeDev.github.io/Kade-Engine/))
If you're looking for documentation, changelogs, or guides, you can find those on the Kade Engine website.
# Previews ([skip](#features))
![Tutorial (Hard) on Downscroll](https://user-images.githubusercontent.com/15311104/113989685-fa5aea80-9850-11eb-9180-f5819a774c79.gif) ![Milf (Hard) on Downscroll](https://user-images.githubusercontent.com/15311104/113990845-2c208100-9852-11eb-8e6d-f1c9e8439871.gif)
![Roses (Hard) on Upscroll](https://user-images.githubusercontent.com/15311104/113993573-e31dfc00-9854-11eb-82ae-1f29dc8a0b04.png)
![Milf (Hard) on Downscroll](https://user-images.githubusercontent.com/15311104/113991654-f4660900-9852-11eb-8c3d-f3927571f19b.png)
![He malding](https://user-images.githubusercontent.com/15311104/113993693-02b52480-9855-11eb-9975-eb8a7a1be8d1.png)
![Free Play selection screen](https://i.imgur.com/LR0eWIC.png)
![Options Menu](https://i.imgur.com/LBXW9C1.png)
# Features
- **New Input System**
- An improved input system, similar to Quaver or Etterna, with less delays, less dropped inputs and other improvements.
- **More information during gameplay**
- While you're playing, we show you information about how you're doing, such as your accuracy, combo break count, notes per second, and your grade/rating.
- **Better key layouts**
- Instead of being forced to use WASD and the arrow keys, now you can play with DFJK!
- **Replays** (in beta)
- Have you ever gotten a crazy score but didn't record? The replay system solves that: it automatically saves a "replay" of your gameplay every time you complete a song, which you can play back inside of the game.
- Replays just store information about what you're doing, they don't actually record the screen -- so they take up way less space on your disk than videos.
- **Audio offset**
- If your headphones are delayed, you can set an offset in the options menu to line the game up with the delay and play with synced audio like intended.
# Credits
### Friday Night Funkin'
- [ninjamuffin99](https://twitter.com/ninja_muffin99) - Programming
- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art
- [Kawai Sprite](https://twitter.com/kawaisprite) - Music
This game was made with love to Newgrounds and its community. Extra love to Tom Fulp.
### Kade Engine
- [KadeDeveloper](https://twitter.com/KadeDeveloper) - Maintainer and lead programmer
- [The contributors](https://github.com/KadeDev/Kade-Engine/graphs/contributors)
![Kade Engine logo](assets/preload/images/KadeEngineLogo.png)
[![AppVeyor](https://img.shields.io/appveyor/build/KadeDev/Kade-Engine-Windows?label=windows%20build)](https://ci.appveyor.com/project/KadeDev/kade-engine-windows/branch/master/artifacts) [![AppVeyor](https://img.shields.io/appveyor/build/KadeDev/Kade-Engine-Macos?label=macOS%20build)](https://ci.appveyor.com/project/KadeDev/kade-engine-macos/branch/master/artifacts) [![AppVeyor](https://img.shields.io/appveyor/build/KadeDev/Kade-Engine-Linux?label=linux%20build)](https://ci.appveyor.com/project/KadeDev/kade-engine-linux/branch/master/artifacts) [![AppVeyor](https://img.shields.io/appveyor/build/daniel11420/KadeEngineWeb?label=html5&20build)](https://ci.appveyor.com/project/daniel11420/KadeEngineWeb) [![Discord](https://img.shields.io/discord/808039740464300104?label=discord)](https://discord.gg/MG6GQFh52U) [![GitHub issues](https://img.shields.io/github/issues/KadeDev/Kade-Engine)](https://github.com/KadeDev/Kade-Engine/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/KadeDev/Kade-Engine)](https://github.com/KadeDev/Kade-Engine/pulls) []() []()
![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/KadeDev/Kade-Engine/latest) ![GitHub repo size](https://img.shields.io/github/repo-size/KadeDev/Kade-Engine) ![Lines of code](https://img.shields.io/tokei/lines/github/KadeDev/Kade-Engine) ![Supported platforms](https://img.shields.io/badge/supported%20platforms-windows%2C%20macOS%2C%20linux%2C%20html5-blue) ![GitHub all releases](https://img.shields.io/github/downloads/KadeDev/Kade-Engine/total) ![GitHub](https://img.shields.io/github/license/KadeDev/Kade-Engine) ![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/KadeDev/Kade-Engine?include_prereleases&label=latest%20version)
# Friday Night Funkin': Kade Engine
## Friday Night Funkin'
**Friday Night Funkin'** is a rhythm game originally made for Ludum Dare 47 "Stuck In a Loop".
Links: **[itch.io page](https://ninja-muffin24.itch.io/funkin) ⋅ [Newgrounds](https://www.newgrounds.com/portal/view/770371) ⋅ [source code on GitHub](https://github.com/ninjamuffin99/Funkin)**
> Uh oh! Your tryin to kiss ur hot girlfriend, but her MEAN and EVIL dad is trying to KILL you! He's an ex-rockstar, the only way to get to his heart? The power of music...
## Kade Engine
**Kade Engine** is a mod for Friday Night Funkin', including a full engine rework, replays, and more.
Links: **[GameBanana mod page](https://gamebanana.com/gamefiles/16761) ⋅ [play in browser](https://funkin.puyo.xyz) ⋅ [latest stable release](https://github.com/KadeDev/Kade-Engine/releases/latest) ⋅ [latest development build (windows)](https://ci.appveyor.com/project/KadeDev/kade-engine-windows/branch/master/artifacts) ⋅ [latest development build (macOS)](https://ci.appveyor.com/project/KadeDev/kade-engine-macos/branch/master/artifacts) ⋅ [latest development build (linux)](https://ci.appveyor.com/project/KadeDev/kade-engine-linux/branch/master/artifacts)**
**REMEMBER**: This is a **mod**. This is not the vanilla game and should be treated as a **modification**. This is not and probably will never be official, so don't get confused.
## Website ([KadeDev.github.io/kade-engine/](https://KadeDev.github.io/Kade-Engine/))
If you're looking for documentation, changelogs, or guides, you can find those on the Kade Engine website.
# Previews ([skip](#features))
![Tutorial (Hard) on Downscroll](https://user-images.githubusercontent.com/15311104/113989685-fa5aea80-9850-11eb-9180-f5819a774c79.gif) ![Milf (Hard) on Downscroll](https://user-images.githubusercontent.com/15311104/113990845-2c208100-9852-11eb-8e6d-f1c9e8439871.gif)
![Roses (Hard) on Upscroll](https://user-images.githubusercontent.com/15311104/113993573-e31dfc00-9854-11eb-82ae-1f29dc8a0b04.png)
![Milf (Hard) on Downscroll](https://user-images.githubusercontent.com/15311104/113991654-f4660900-9852-11eb-8c3d-f3927571f19b.png)
![He malding](https://user-images.githubusercontent.com/15311104/113993693-02b52480-9855-11eb-9975-eb8a7a1be8d1.png)
![Free Play selection screen](https://i.imgur.com/LR0eWIC.png)
![Options Menu](https://i.imgur.com/LBXW9C1.png)
# Features
- **New Input System**
- An improved input system, similar to Quaver or Etterna, with less delays, less dropped inputs and other improvements.
- **More information during gameplay**
- While you're playing, we show you information about how you're doing, such as your accuracy, combo break count, notes per second, and your grade/rating.
- **Customizable keybinds**
- Instead of being forced to use WASD and the arrow keys, you can customize the keybinds to any keys you want!
- **Replays** (in beta)
- Have you ever gotten a crazy score but didn't record? The replay system solves that: it automatically saves a "replay" of your gameplay every time you complete a song, which you can play back inside of the game.
- Replays just store information about what you're doing, they don't actually record the screen -- so they take up way less space on your disk than videos.
- **Audio offset**
- If your headphones are delayed, you can set an offset in the options menu to line the game up with the delay and play with synced audio like intended.
# Credits
### Friday Night Funkin'
- [ninjamuffin99](https://twitter.com/ninja_muffin99) - Programming
- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art
- [Kawai Sprite](https://twitter.com/kawaisprite) - Music
This game was made with love to Newgrounds and its community. Extra love to Tom Fulp.
### Kade Engine
- [KadeDeveloper](https://twitter.com/KadeDeveloper) - Maintainer and lead programmer
- [The contributors](https://github.com/KadeDev/Kade-Engine/graphs/contributors)
### Shoutouts
- [GWebDev](https://github.com/GrowtopiaFli) - Video Code
- [Rozebud](https://github.com/ThatRozebudDude) - Ideas (that I stole)
- [Puyo](https://github.com/daniel11420) - Setting up appveyor and a lot of other help

View File

@ -28,6 +28,8 @@ install:
- haxelib git faxe https://github.com/uhrobots/faxe
- haxelib git polymod https://github.com/larsiusprime/polymod.git
- haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib run lime rebuild extension-webm linux
- haxelib install linc_luajit
- haxelib list
- cd /home/appveyor/projects/kade-engine-linux
@ -36,8 +38,8 @@ build_script:
- haxelib run lime build linux
after_build:
- tar -cvf funkin-ke.tar -C /home/appveyor/projects/kade-engine-linux/export/release/linux/bin .
- tar -cvf KadeEngine-Linux.tar -C /home/appveyor/projects/kade-engine-linux/export/release/linux/bin .
artifacts:
- path: funkin-ke.tar
name: Linux build
- path: KadeEngine-Linux.tar
name: Kade Engine for Linux

View File

@ -28,16 +28,18 @@ install:
- haxelib git faxe https://github.com/uhrobots/faxe
- haxelib git polymod https://github.com/larsiusprime/polymod.git
- haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib run lime rebuild extension-webm macos
- haxelib install linc_luajit
- haxelib list
- cd /Users/appveyor/projects/kade-engine-macos
build_script:
- haxelib run lime build mac
after_build:
- gtar -cvf funkin-ke.tar -C /Users/appveyor/projects/kade-engine-macos/export/release/macos/bin .
- hdiutil create /Users/appveyor/temp.dmg -ov -volname "KadeEngine-macOS" -fs HFS+ -srcfolder "/Users/appveyor/projects/kade-engine-macos/export/release/macos/bin"
- hdiutil convert /Users/appveyor/temp.dmg -format UDZO -o KadeEngine-macOS.dmg
artifacts:
- path: funkin-ke.tar
name: macOS build idk
- path: KadeEngine-macOS.dmg
name: Kade Engine for macOS

View File

@ -32,6 +32,8 @@ install:
- haxelib git faxe https://github.com/uhrobots/faxe
- haxelib git polymod https://github.com/larsiusprime/polymod.git
- haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc
- haxelib git extension-webm https://github.com/KadeDev/extension-webm
- haxelib run lime rebuild extension-webm windows
- haxelib install linc_luajit
- haxelib list
@ -42,5 +44,5 @@ build_script:
artifacts:
- path: export/release/windows/bin
name: Windows release
type: zip
name: KadeEngine-Windows
type: zip

View File

@ -6,7 +6,7 @@ Spookeez:spooky:2
South:spooky:2
Monster:monster:2
Pico:pico:3
Philly:pico:3
Philly Nice:pico:3
Blammed:pico:3
Satin Panties:mom:4
High:mom:4

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="KadeEngineLogoBumpin.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="logo bumpin0000" x="0" y="0" width="894" height="670" frameX="-22" frameY="-16" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0001" x="904" y="0" width="939" height="703"/>
<SubTexture name="logo bumpin0002" x="904" y="0" width="939" height="703"/>
<SubTexture name="logo bumpin0003" x="0" y="713" width="911" height="683" frameX="-14" frameY="-10" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0004" x="0" y="713" width="911" height="683" frameX="-14" frameY="-10" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0005" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0006" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0007" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0008" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0009" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0010" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0011" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0012" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0013" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
<SubTexture name="logo bumpin0014" x="921" y="713" width="905" height="679" frameX="-17" frameY="-12" frameWidth="939" frameHeight="703"/>
</TextureAtlas>

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 726 KiB

View File

@ -1,109 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="Monster_Assets.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Monster Right note0000" x="0" y="0" width="375" height="674" frameX="-4" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0001" x="0" y="0" width="375" height="674" frameX="-4" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0002" x="385" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0003" x="385" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0004" x="776" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0005" x="776" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0006" x="1167" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0007" x="1167" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0008" x="1558" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0009" x="1558" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0010" x="1949" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0011" x="1949" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0012" x="2340" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0013" x="2340" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster Right note0014" x="385" y="0" width="381" height="671" frameX="0" frameY="0" frameWidth="381" frameHeight="674"/>
<SubTexture name="Monster left note0000" x="2731" y="0" width="460" height="671" frameX="-15" frameY="0" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0001" x="2731" y="0" width="460" height="671" frameX="-15" frameY="0" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0002" x="3201" y="0" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0003" x="3201" y="0" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0004" x="0" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0005" x="0" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0006" x="481" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0007" x="481" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0008" x="962" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0009" x="962" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0010" x="1443" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0011" x="1443" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0012" x="1924" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0013" x="1924" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0014" x="3201" y="0" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0015" x="3201" y="0" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0016" x="0" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0017" x="0" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0018" x="481" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="Monster left note0019" x="481" y="684" width="471" height="668" frameX="0" frameY="-5" frameWidth="475" frameHeight="673"/>
<SubTexture name="monster down0000" x="2405" y="684" width="428" height="599" frameX="-12" frameY="-35" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0001" x="2405" y="684" width="428" height="599" frameX="-12" frameY="-35" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0002" x="2843" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0003" x="2843" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0004" x="3287" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0005" x="3287" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0006" x="0" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0007" x="0" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0008" x="444" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0009" x="444" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0010" x="888" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0011" x="888" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0012" x="1332" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0013" x="1332" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0014" x="2843" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0015" x="2843" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0016" x="3287" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0017" x="3287" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0018" x="0" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0019" x="0" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0020" x="444" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0021" x="444" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0022" x="888" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0023" x="888" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0024" x="1332" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0025" x="1332" y="1362" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0026" x="2843" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0027" x="2843" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0028" x="3287" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster down0029" x="3287" y="684" width="434" height="633" frameX="0" frameY="0" frameWidth="440" frameHeight="634"/>
<SubTexture name="monster idle0000" x="1776" y="1362" width="424" height="604" frameX="-46" frameY="-73" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0001" x="1776" y="1362" width="424" height="604" frameX="-46" frameY="-73" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0002" x="2210" y="1362" width="422" height="605" frameX="-49" frameY="-69" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0003" x="2210" y="1362" width="422" height="605" frameX="-49" frameY="-69" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0004" x="2642" y="1362" width="439" height="610" frameX="-38" frameY="-61" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0005" x="3091" y="1362" width="439" height="630" frameX="-38" frameY="-41" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0006" x="3540" y="1362" width="481" height="661" frameX="-3" frameY="-11" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0007" x="3540" y="1362" width="481" height="661" frameX="-3" frameY="-11" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0008" x="0" y="2033" width="484" height="670" frameX="0" frameY="-3" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0009" x="0" y="2033" width="484" height="670" frameX="0" frameY="-3" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0010" x="494" y="2033" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0011" x="494" y="2033" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0012" x="988" y="2033" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0013" x="988" y="2033" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0014" x="1482" y="2033" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster up note0000" x="1976" y="2033" width="410" height="714" frameX="-7" frameY="0" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0001" x="1976" y="2033" width="410" height="714" frameX="-7" frameY="0" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0002" x="2396" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0003" x="2396" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0004" x="2824" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0005" x="2824" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0006" x="3252" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0007" x="3252" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0008" x="0" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0009" x="0" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0010" x="428" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0011" x="428" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0012" x="856" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0013" x="856" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0014" x="2396" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0015" x="2396" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0016" x="2824" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0017" x="2824" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0018" x="3252" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0019" x="3252" y="2033" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0020" x="0" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0021" x="0" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0022" x="428" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
<SubTexture name="monster up note0023" x="428" y="2757" width="418" height="711" frameX="0" frameY="-9" frameWidth="418" frameHeight="720"/>
</TextureAtlas>
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="Monster_Assets.png">
<!-- Created with Adobe Animate version 21.0.0.35450 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Monster Right note0000" x="0" y="0" width="375" height="691" frameX="-4" frameY="0" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0001" x="0" y="0" width="375" height="691" frameX="-4" frameY="0" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0002" x="385" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0003" x="776" y="0" width="381" height="679" frameX="0" frameY="-9" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0004" x="1167" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0005" x="1558" y="0" width="381" height="679" frameX="0" frameY="-9" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0006" x="1949" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0007" x="2340" y="0" width="381" height="679" frameX="0" frameY="-9" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0008" x="2731" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0009" x="3122" y="0" width="381" height="679" frameX="0" frameY="-9" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0010" x="3513" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0011" x="3904" y="0" width="381" height="679" frameX="0" frameY="-9" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0012" x="4295" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0013" x="4686" y="0" width="381" height="679" frameX="0" frameY="-9" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster Right note0014" x="385" y="0" width="381" height="680" frameX="0" frameY="-8" frameWidth="381" frameHeight="691"/>
<SubTexture name="Monster left note0000" x="5077" y="0" width="460" height="675" frameX="-15" frameY="0" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0001" x="5077" y="0" width="460" height="675" frameX="-15" frameY="0" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0002" x="5547" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0003" x="6028" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0004" x="6509" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0005" x="6990" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0006" x="7471" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0007" x="0" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0008" x="481" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0009" x="962" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0010" x="1443" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0011" x="1924" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0012" x="2405" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0013" x="2886" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0014" x="5547" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0015" x="6028" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0016" x="6509" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0017" x="6990" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0018" x="7471" y="0" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="Monster left note0019" x="0" y="701" width="471" height="669" frameX="0" frameY="-8" frameWidth="475" frameHeight="677"/>
<SubTexture name="monster down0000" x="3367" y="701" width="428" height="571" frameX="-12" frameY="-18" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0001" x="3367" y="701" width="428" height="571" frameX="-12" frameY="-18" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0002" x="3805" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0003" x="4249" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0004" x="4693" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0005" x="5137" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0006" x="5581" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0007" x="6025" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0008" x="6469" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0009" x="6913" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0010" x="7357" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0011" x="0" y="1380" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0012" x="444" y="1380" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0013" x="888" y="1380" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0014" x="3805" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0015" x="4249" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0016" x="4693" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0017" x="5137" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0018" x="5581" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0019" x="6025" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0020" x="6469" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0021" x="6913" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0022" x="4249" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0023" x="4249" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0024" x="6913" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0025" x="6913" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0026" x="4249" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0027" x="4249" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0028" x="6913" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster down0029" x="6913" y="701" width="434" height="588" frameX="0" frameY="0" frameWidth="440" frameHeight="589"/>
<SubTexture name="monster idle0000" x="1332" y="1380" width="424" height="603" frameX="-46" frameY="-74" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0001" x="1766" y="1380" width="424" height="602" frameX="-46" frameY="-75" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0002" x="2200" y="1380" width="422" height="607" frameX="-49" frameY="-67" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0003" x="2632" y="1380" width="422" height="607" frameX="-49" frameY="-67" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0004" x="3064" y="1380" width="439" height="610" frameX="-38" frameY="-61" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0005" x="3513" y="1380" width="439" height="630" frameX="-38" frameY="-41" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0006" x="3962" y="1380" width="481" height="660" frameX="-3" frameY="-12" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0007" x="4453" y="1380" width="481" height="660" frameX="-3" frameY="-12" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0008" x="4944" y="1380" width="484" height="671" frameX="0" frameY="-2" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0009" x="5438" y="1380" width="484" height="671" frameX="0" frameY="-2" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0010" x="5932" y="1380" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0011" x="6426" y="1380" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0012" x="6920" y="1380" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0013" x="7414" y="1380" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster idle0014" x="0" y="2063" width="484" height="673" frameX="0" frameY="0" frameWidth="484" frameHeight="677"/>
<SubTexture name="monster up note0000" x="494" y="2063" width="410" height="753" frameX="-7" frameY="0" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0001" x="494" y="2063" width="410" height="753" frameX="-7" frameY="0" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0002" x="914" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0003" x="1342" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0004" x="1770" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0005" x="2198" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0006" x="2626" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0007" x="3054" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0008" x="3482" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0009" x="3910" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0010" x="4338" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0011" x="4766" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0012" x="5194" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0013" x="5622" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0014" x="914" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0015" x="1342" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0016" x="1770" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0017" x="2198" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0018" x="2626" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0019" x="3054" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0020" x="3482" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0021" x="3910" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0022" x="4338" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
<SubTexture name="monster up note0023" x="4766" y="2063" width="418" height="721" frameX="0" frameY="-38" frameWidth="418" frameHeight="759"/>
</TextureAtlas>

View File

@ -26,7 +26,7 @@ hr {
<p id="HtmlIsTheWorstThingIHaveEverUsed">
<a class="headerlink" href="{{site.url}}changelogs/">Changelogs</a>
<a class="headerlink" href="{{site.url}}building">Building</a>
<a class="headerlink" href="{{site.url}}modchart">Modcharts</a>
<a class="headerlink" href="https://github.com/KadeDev/Kade-Engine/wiki/">Modchart Documentation</a>
<a class="headerlink" href="{{site.url}}guides">Guides</a>
<br>&nbsp;
<hr>

View File

@ -28,13 +28,28 @@
- `haxelib git faxe https://github.com/uhrobots/faxe`
- `haxelib git polymod https://github.com/larsiusprime/polymod.git`
- `haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc`
- `haxelib install actuate`
- `haxelib git extension-webm https://github.com/KadeDev/extension-webm`
- `lime rebuild extension-webm windows`
### Windows-only dependencies (only for building *to* Windows. Building html5 on Windows does not require this)
If you are planning to build for Windows, you also need to install **Visual Studio 2019**. While installing it, *don't click on any of the options to install workloads*. Instead, go to the **individual components** tab and choose the following:
- MSVC v142 - VS 2019 C++ x64/x86 build tools
- Windows SDK (10.0.19041.0)
This will install about 4 GB of crap, but is necessary to build for Windows.
- MSVC v142 - VS 2019 C++ x64/x86 build tools
- Windows SDK (10.0.17763.0)
- C++ Profiling tools
- C++ CMake tools for windows
- C++ ATL for v142 build tools (x86 & x64)
- C++ MFC for v142 build tools (x86 & x64)
- C++/CLI support for v142 build tools (14.21)
- C++ Modules for v142 build tools (x64/x86)
- Clang Compiler for Windows
- Windows 10 SDK (10.0.17134.0)
- Windows 10 SDK (10.0.16299.0)
- MSVC v141 - VS 2017 C++ x64/x86 build tools
- MSVC v140 - VS 2015 C++ build tools (v14.00)
This will install about 22 GB of crap, but is necessary to build for Windows.
### macOS-only dependencies (these are required for building on macOS at all, including html5.)
If you are running macOS, you'll need to install Xcode. You can download it from the macOS App Store or from the [Xcode website](https://developer.apple.com/xcode/).

View File

@ -0,0 +1,14 @@
# Changelog for 1.5.2
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.
### Additions
- [PR #786](https://github.com/KadeDev/Kade-Engine/pull/786): Add Acceleration, Drag and Velocity to X and Y for Actors in modcharts
### Bugfixes
- [PR #756](https://github.com/KadeDev/Kade-Engine/pull/756): Fix bugs with combo counter
- 💖 PRs [#763](https://github.com/KadeDev/Kade-Engine/pull/763), [#789](https://github.com/KadeDev/Kade-Engine/pull/789): Fix bug where songs with spaces in the name would crash
- Fix skipping notes for judgements
## Links
[GitHub Release](https://github.com/KadeDev/Kade-Engine/releases/tag/1.5.2) · [Last Windows CI build]() · [Last macOS CI build]() · [Last Linux CI build]()

View File

@ -0,0 +1,19 @@
# Changelog for 1.5.3
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.
### Additions
- Score Screen (💖)
- Show your highest combo in the freeplay menu
- New asset loading system (💖)
- New Logo (💖)
### Changes
- Rewrote the entire hit ranking system (💖)
### Bugfixes
- NPS not showing if accuracy is disabled
- Fixed song names so they don't crash (💖)
## Links
[GitHub Release](https://github.com/KadeDev/Kade-Engine/releases/tag/1.5.3) · [Last Windows CI build](https://ci.appveyor.com/project/KadeDev/kade-engine-windows/builds/39671466) · [Last macOS CI build](https://ci.appveyor.com/project/KadeDev/kade-engine-macos/builds/39671465) · [Last Linux CI build](https://ci.appveyor.com/project/KadeDev/kade-engine-linux/builds/39671464)

View File

@ -1,4 +1,4 @@
# Latest changelog/Changelog for 1.0.0
# Latest (master) changelog/Changelog for 1.0.0
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.

View File

@ -1,4 +1,8 @@
# Changelogs
- [Latest](latest) (Contains changes that are not in a release yet)
- [1.5.3](changelog-1.5.3)
- [1.5.2](changelog-1.5.2)
- [1.5.1](changelog-1.5.1)
- [1.5.0](changelog-1.5.0)
- [1.4.2 and before](changelog-pre)

View File

@ -1 +1,12 @@
# Latest changelog
# Latest (master) changelog
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.
### Additions
- Nothing yet!
### Changes
- Nothing yet!
### Bugfixes
- Nothing yet!

View File

@ -1,483 +1,2 @@
# Lua Modcharts
In the 1.4.2 release of Kade Engine, we introduced Mod Charts. Mod Charts are a way of changing gameplay without hard coded values. This is achieved by using the Lua Scripting language to create script files that run during runtime.
Song data is located in `assets/data/<song>/`, so the Lua file containing your scripts should be located at exactly `assets/data/<song>/modchart.lua`. (replace <song> with the name of the song. for example, `assets/data/milf/` for milf)
If the file doesn't exist, Lua code won't be ran.
## Examples
Full Example
```lua
function start (song)
print("Song: " .. song .. " @ " .. bpm .. " downscroll: " .. downscroll)
end
function update (elapsed) -- example https://twitter.com/KadeDeveloper/status/1382178179184422918
local currentBeat = (songPos / 1000)*(bpm/60)
for i=0,7 do
setActorX(_G['defaultStrum'..i..'X'] + 32 * math.sin((currentBeat + i*0.25) * math.pi), i)
setActorY(_G['defaultStrum'..i..'Y'] + 32 * math.cos((currentBeat + i*0.25) * math.pi), i)
end
end
function beatHit (beat)
-- do nothing
end
function stepHit (step)
-- do nothing
end
function keyPressed (key)
-- do nothing
end
print("Mod Chart script loaded :)")
```
Spinning Receptor Example
```lua
function update (elapsed)
for i=0,7 do
setActorAngle(getActorAngle(i) + 15, i)
end
end
```
Spinning Hud Example
```lua
function update (elapsed)
camHudAngle = camHudAngle + 0.005
end
```
Spin at a specific part of the song
```lua
function update (elapsed)
if curStep >= 352 and curStep < 400 then
local currentBeat = (songPos / 1000)*(bpm/60)
for i=0,7 do
setActorX(_G['defaultStrum'..i..'X'] + 32 * math.sin((currentBeat + i*0.25) * math.pi), i)
setActorY(_G['defaultStrum'..i..'Y'] + 32 * math.cos((currentBeat + i*0.25) * math.pi), i)
end
else
for i=0,7 do
setActorX(_G['defaultStrum'..i..'X'],i)
setActorY(_G['defaultStrum'..i..'Y'],i)
end
end
end
```
Showing/Hiding receptors/the hud
```lua
function start (song)
showOnlyStrums = true -- remove all hud elements besides notes and strums
for i=0,3 do -- fade out the first 4 receptors (the ai receptors)
tweenFadeIn(i,0,0.6)
end
end
```
Looping through all of the rendered notes
```lua
for i = 0, getRenderedNotes() do -- sets all of the rendered notes to 0 0 on the x and y axsis
setRenderedNotePos(0,0,i)
end
```
Centering BF's Side
```lua
function setDefault(id)
_G['defaultStrum'..id..'X'] = getActorX(id)
end
-- put this somewhere in a function
for i = 4, 7 do -- go to the center
tweenPosXAngle(i, _G['defaultStrum'..i..'X'] - 275,getActorAngle(i) + 360, 0.6, 'setDefault')
end
```
### Available Hooks
Current calls to functions include,
| Name | Arguments | Description |
| :-----: | :------------: | :----------------------------------------------------------: |
| start | Song Name | Gets called when the song starts |
| update | Elapsed frames | Gets called every frame (after the song starts) |
| stepHit | Current Step | Gets called when ever a step hits (steps are in between beats, aka 4 steps are in a beat) |
| beatHit | Current Beat | Gets called when ever a beat hits |
| keyPressed | Key Pressed | Gets called when a key just got pressed (up, down, left, right, accept) |
### Global Variables
Kade Engine provides a list of global variables to be used in the lua scripting interface.
| G Name | Type | Description |
| :------------------: | :---: | :----------------------------------------------------------: |
| bpm | Float | The current BPM of the song |
| fpsCap | Int | The current FPS Cap (set by the player) |
| downscroll | Bool | Whether the player is in downscroll or not |
| cameraAngle | Float | The angle that the Main Camera should be rotated |
| camHudAngle | Float | The angle that the Hud should be rotated |
| followXOffset | Float | The x offset to be added when the camera moves between a character |
| followYOffset | Float | The y offset to be added when the camera moves between a character |
| showOnlyStrums | Bool | Whether to show the Hud and Strums or only the Strums |
| strumLine1Visible | Bool | Whether to show the first strum line or not |
| strumLine2Visible | Bool | Whether to show the secondstrum line or not |
| defaultStrum0-7X | Float | (0-7 is strum0,strum1,strum2,etc) get the default X coordinate for the strum |
| defaultStrum0-7Y | Float | (0-7 is strum0,strum1,strum2,etc) get the default Y coordinate for the strum |
| defaultStrum0-7Angle | Float | (0-7 is strum0,strum1,strum2,etc) get the default Angle for the strum |
| screenWidth | Int | The width of the current gamespace |
| screenHeight | Int | The height of the current gamespace |
| hudWidth | Int | The width of the hud |
| hudHeight | Int | The height of the hud |
| scrollSpeed | Int | The current scrollspeed |
| mustHit | Bool | If the current section is a must hit section |
| strumLineY | Float | The current Strum Line Y Position |
## Functions
Kade Engine exposes a lot of functions that let you modify elements in the game field.
To get started every sprite has an id, and there are some id's that are accessible without creating one.
These premade id's are the following:
| Sprite Id | Value |
| :--------: | :--------------------------------------: |
| 0-7 | Represents Receptor 0-7 |
| boyfriend | Represents the Boyfriend Actor (player1) |
| dad | Represents the Dad Actor (player2) |
| girlfriend | Represents the Girlfriend Actor |
### Sprites
##### makeSprite(string SpritePath,string SpriteId,bool DrawBehind)
Creates a sprite out of the specified image, returns the id you gave it.
*Note: Sprite Path is normally the FILE NAME so if your file is named `Image` it'll go to assets/data/songName/Image.png so don't include the extension*
### Hud/Camera
##### setHudPosition(int x, int y)
Sets the game hud's position in space.
##### getHudX()
Returns the hud's x position
##### getHudY()
Returns the hud's y position
##### setCamPosition(int x, int y)
Set's the current camera's position in space
##### getCameraX()
Returns the current camera's x position
##### getCameraY()
Returns the current camera's y position
##### setCamZoom(float zoomAmount)
Set's the current camera's zoom
##### setHudZoom(float zoomAmount)
Set's the hud's zoom
### Strumline
##### setStrumlineY(float y)
Set's the y position of the strumLine
### Actors
##### getRenderedNotes()
Returns the amount of rendered notes.
##### getRenderedNoteX(int id)
Returns the x position of the rendered note id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteY(int id)
Returns the y position of the rendered note id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteScaleX(int id)
Returns the scale x of the rendered note id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteScaleY(int id)
Returns the scale y of the rendered note id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteType(int id)
Returns the note data of an note (0-3, left, down, up, right)
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteHit(int id)
Returns whether a rendered note must be hit by the player or not
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### isSustain(int id)
Returns whether a rendered note is a sustain note or not (if they appear as the trail)
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### isParentSustain(int id)
Returns whether a rendered note's parrent is a sustain note or not (if they appear as the trail)
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteParentX(int id)
Returns the current parent x of the specified rendered note's id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteParentY(int id)
Returns the current parent y of the specified rendered note's id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteCalcX(int id)
Returns what the game would normally put the specified rendered note x.
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### anyNotes()
Returns true if there are rendered notes, and returns false if there are none
##### getRenderedNoteStrumtime(int id)
Returns strum time of the rendered note.
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteAlpha(int id)
Returns the alpha of the rendered note id
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteWidth(int id)
Returns the width of the specified rendered note.
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### getRenderedNoteAngle(int id)
Returns the angle of the specified rendered note.
*Note: Rendered Notes id's are special in the way that they act. 0 = closest note to any receptor, last index = the farthest away from any receptor.*
##### setRenderedNotePos(int x, int y, int id)
Set's the position of the rendered note id
*Note: Setting a Rendered Note's property will stop the note from updating it's alpha & x properties*
##### setRenderedNoteAlpha(float alpha, int id)
Set's the alpha of the rendered note id
*Note: Setting a Rendered Note's property will stop the note from updating it's alpha & x properties*
##### setRenderedNoteScale(float scale, int id)
Set's the scale of the rendered note id
*Note: Setting a Rendered Note's property will stop the note from updating it's alpha & x properties*
##### setRenderedNoteScaleX(float scale, int id) **Currently broken**
Set's the scale x of the rendered note id
*Note: Setting a Rendered Note's property will stop the note from updating it's alpha & x properties*
##### setRenderedNoteScaleY(float scale, int id) **Currently broken**
Set's the scale y of the rendered note id
*Note: Setting a Rendered Note's property will stop the note from updating it's alpha & x properties*
##### getActorX(string/int id)
Returns the x position for the sprite id
##### getActorY(string/int id)
Returns the y position for the sprite id
##### getActorScaleX(string/int id)
Returns the scale x for the sprite id
##### getActorScaleY(string/int id)
Returns the scale y for the sprite id
##### getActorAlpha(string/int id)
Returns the alpha for the sprite id
##### getActorAngle(string/int id)
Returns the angle for the sprite id
##### setActorX(int x, string/int id)
Set's the x position for the sprite id
##### setActorY(int y, string/int id)
Set's the y position for the sprite id
##### setActorAlpha(float alpha, string/int id)
Set's the alpha for the sprite id
##### setActorAngle(int alpha, string/int id)
Set's the angle for the sprite id
##### setActorScale(float scale, string/int id)
Set's the scale for the sprite id
##### setActorScaleXY(float scaleX, float scaleY, string/int id)
Set's the x and y scale for the sprite id
##### setActorFlipX(bool flip, string/int id)
Set's the x flip for the sprite id
##### setActorFlipY(bool flip, string/int id)
Set's the y flip for the sprite id
##### getActorWidth(string/int id)
Returns the width for the sprite id
##### getActorHeight(string/int id)
Returns the height for the sprite id
##### changeBoyfriendCharacter(string id)
Changes the Boyfriend sprite to another character
##### changeDadCharacter(string id)
Changes the Dad sprite to another character
##### playActorAnimation(string/int id, string anim, bool force, bool reverse)
Plays an animation on a sprite
### Tweens
*Note, On Complete functions are based by the function name (and they also well get called when the tween completes)*
##### tweenPos(string/int id, int toX, int toY, float time, string onComplete)
Smoothly tween into a x and y position
##### tweenPosXAngle(string/int id, int toX, float toAngle, float time, string onComplete)
Smoothly tween into a x position and angle
##### tweenPosYAngle(string/int id, int toY, float toAngle, float time, string onComplete)
Smoothly tween into a y position and angle
##### tweenAngle(string/int id, float toAngle, float time, string onComplete)
Smoothly tween into a angle
##### tweenFadeIn(string/int id, float toAlpha, float time, string onComplete)
Smoothly fade in to an alpha
##### tweenFadeOut(string/int id, float toAlpha, float time, string onComplete)
Smoothly fade out to an alpha
### Window & Screen
##### getWindowX()
Returns the window's x position
##### getWindowY()
Returns the window's y position
##### getScreenWidth()
Returns the width of the screen
##### getScreenHeight()
Returns the height of the screen
##### setWindowPos(int x, int y)
Sets the window's position
##### resizeWindow(int width, int height)
Resizes the window
### RELOCATED
Relocated to [here](https://github.com/KadeDev/Kade-Engine/wiki/)

View File

@ -0,0 +1,7 @@
package;
class APIStuff
{
public static var API:String = "";
public static var EncKey:String = "";
}

358
source - Copy/Alphabet.hx Normal file
View File

@ -0,0 +1,358 @@
package;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup;
import flixel.math.FlxMath;
import flixel.util.FlxTimer;
using StringTools;
/**
* Loosley based on FlxTypeText lolol
*/
class Alphabet extends FlxSpriteGroup
{
public var delay:Float = 0.05;
public var paused:Bool = false;
// for menu shit
public var targetY:Float = 0;
public var isMenuItem:Bool = false;
public var text:String = "";
var _finalText:String = "";
var _curText:String = "";
public var widthOfWords:Float = FlxG.width;
var yMulti:Float = 1;
// custom shit
// amp, backslash, question mark, apostrophy, comma, angry faic, period
var lastSprite:AlphaCharacter;
var xPosResetted:Bool = false;
var lastWasSpace:Bool = false;
var listOAlphabets:List<AlphaCharacter> = new List<AlphaCharacter>();
var splitWords:Array<String> = [];
var isBold:Bool = false;
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false, shouldMove:Bool = false)
{
super(x, y);
_finalText = text;
this.text = text;
isBold = bold;
if (text != "")
{
if (typed)
{
startTypedText();
}
else
{
addText();
}
}
}
public function addText()
{
doSplitWords();
var xPos:Float = 0;
for (character in splitWords)
{
// if (character.fastCodeAt() == " ")
// {
// }
if (character == " " || character == "-")
{
lastWasSpace = true;
}
if (AlphaCharacter.alphabet.indexOf(character.toLowerCase()) != -1)
// if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
{
if (lastSprite != null)
{
xPos = lastSprite.x + lastSprite.width;
}
if (lastWasSpace)
{
xPos += 40;
lastWasSpace = false;
}
// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
listOAlphabets.add(letter);
if (isBold)
letter.createBold(character);
else
{
letter.createLetter(character);
}
add(letter);
lastSprite = letter;
}
// loopNum += 1;
}
}
function doSplitWords():Void
{
splitWords = _finalText.split("");
}
public var personTalking:String = 'gf';
public function startTypedText():Void
{
_finalText = text;
doSplitWords();
// trace(arrayShit);
var loopNum:Int = 0;
var xPos:Float = 0;
var curRow:Int = 0;
new FlxTimer().start(0.05, function(tmr:FlxTimer)
{
// trace(_finalText.fastCodeAt(loopNum) + " " + _finalText.charAt(loopNum));
if (_finalText.fastCodeAt(loopNum) == "\n".code)
{
yMulti += 1;
xPosResetted = true;
xPos = 0;
curRow += 1;
}
if (splitWords[loopNum] == " ")
{
lastWasSpace = true;
}
#if (haxe >= "4.0.0")
var isNumber:Bool = AlphaCharacter.numbers.contains(splitWords[loopNum]);
var isSymbol:Bool = AlphaCharacter.symbols.contains(splitWords[loopNum]);
#else
var isNumber:Bool = AlphaCharacter.numbers.indexOf(splitWords[loopNum]) != -1;
var isSymbol:Bool = AlphaCharacter.symbols.indexOf(splitWords[loopNum]) != -1;
#end
if (AlphaCharacter.alphabet.indexOf(splitWords[loopNum].toLowerCase()) != -1 || isNumber || isSymbol)
// if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()) || isNumber || isSymbol)
{
if (lastSprite != null && !xPosResetted)
{
lastSprite.updateHitbox();
xPos += lastSprite.width + 3;
// if (isBold)
// xPos -= 80;
}
else
{
xPosResetted = false;
}
if (lastWasSpace)
{
xPos += 20;
lastWasSpace = false;
}
// trace(_finalText.fastCodeAt(loopNum) + " " + _finalText.charAt(loopNum));
// var letter:AlphaCharacter = new AlphaCharacter(30 * loopNum, 0);
var letter:AlphaCharacter = new AlphaCharacter(xPos, 55 * yMulti);
listOAlphabets.add(letter);
letter.row = curRow;
if (isBold)
{
letter.createBold(splitWords[loopNum]);
}
else
{
if (isNumber)
{
letter.createNumber(splitWords[loopNum]);
}
else if (isSymbol)
{
letter.createSymbol(splitWords[loopNum]);
}
else
{
letter.createLetter(splitWords[loopNum]);
}
letter.x += 90;
}
if (FlxG.random.bool(40))
{
var daSound:String = "GF_";
FlxG.sound.play(Paths.soundRandom(daSound, 1, 4));
}
add(letter);
lastSprite = letter;
}
loopNum += 1;
tmr.time = FlxG.random.float(0.04, 0.09);
}, splitWords.length);
}
override function update(elapsed:Float)
{
if (isMenuItem)
{
var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3);
y = FlxMath.lerp(y, (scaledY * 120) + (FlxG.height * 0.48), 0.30);
x = FlxMath.lerp(x, (targetY * 20) + 90, 0.30);
}
super.update(elapsed);
}
}
class AlphaCharacter extends FlxSprite
{
public static var alphabet:String = "abcdefghijklmnopqrstuvwxyz";
public static var numbers:String = "1234567890";
public static var symbols:String = "|~#$%()*+-:;<=>@[]^_.,'!? ";
public var row:Int = 0;
public function new(x:Float, y:Float)
{
super(x, y);
var tex = Paths.getSparrowAtlas('alphabet');
frames = tex;
antialiasing = true;
}
public function createBold(letter:String)
{
animation.addByPrefix(letter, letter.toUpperCase() + " bold", 24);
animation.play(letter);
updateHitbox();
}
public function createLetter(letter:String):Void
{
var letterCase:String = "lowercase";
if (letter.toLowerCase() != letter)
{
letterCase = 'capital';
}
animation.addByPrefix(letter, letter + " " + letterCase, 24);
animation.play(letter);
updateHitbox();
FlxG.log.add('the row' + row);
y = (110 - height);
y += row * 60;
}
public function createNumber(letter:String):Void
{
animation.addByPrefix(letter, letter, 24);
animation.play(letter);
updateHitbox();
}
public function createSymbol(letter:String)
{
switch (letter)
{
case '.':
animation.addByPrefix(letter, 'period', 24);
animation.play(letter);
y += 50;
case "'":
animation.addByPrefix(letter, 'apostraphie', 24);
animation.play(letter);
y -= 0;
case "?":
animation.addByPrefix(letter, 'question mark', 24);
animation.play(letter);
case "!":
animation.addByPrefix(letter, 'exclamation point', 24);
animation.play(letter);
case '_':
animation.addByPrefix(letter, '_', 24);
animation.play(letter);
y += 50;
case "#":
animation.addByPrefix(letter, '#', 24);
animation.play(letter);
case "$":
animation.addByPrefix(letter, '$', 24);
animation.play(letter);
case "%":
animation.addByPrefix(letter, '%', 24);
animation.play(letter);
case "&":
animation.addByPrefix(letter, '&', 24);
animation.play(letter);
case "(":
animation.addByPrefix(letter, '(', 24);
animation.play(letter);
case ")":
animation.addByPrefix(letter, ')', 24);
animation.play(letter);
case "+":
animation.addByPrefix(letter, '+', 24);
animation.play(letter);
case "-":
animation.addByPrefix(letter, '-', 24);
animation.play(letter);
case '"':
animation.addByPrefix(letter, '"', 24);
animation.play(letter);
y -= 0;
case '@':
animation.addByPrefix(letter, '@', 24);
animation.play(letter);
case "^":
animation.addByPrefix(letter, '^', 24);
animation.play(letter);
y -= 0;
case ' ':
animation.addByPrefix(letter, 'space', 24);
animation.play(letter);
}
updateHitbox();
}
}

View File

@ -0,0 +1,195 @@
package;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
/**
*DEBUG MODE
*/
class AnimationDebug extends FlxState
{
var bf:Boyfriend;
var dad:Character;
var char:Character;
var textAnim:FlxText;
var dumbTexts:FlxTypedGroup<FlxText>;
var animList:Array<String> = [];
var curAnim:Int = 0;
var isDad:Bool = true;
var daAnim:String = 'spooky';
var camFollow:FlxObject;
public function new(daAnim:String = 'spooky')
{
super();
this.daAnim = daAnim;
}
override function create()
{
FlxG.sound.music.stop();
var gridBG:FlxSprite = FlxGridOverlay.create(10, 10);
gridBG.scrollFactor.set(0.5, 0.5);
add(gridBG);
if (daAnim == 'bf')
isDad = false;
if (isDad)
{
dad = new Character(0, 0, daAnim);
dad.screenCenter();
dad.debugMode = true;
add(dad);
char = dad;
dad.flipX = false;
}
else
{
bf = new Boyfriend(0, 0);
bf.screenCenter();
bf.debugMode = true;
add(bf);
char = bf;
bf.flipX = false;
}
dumbTexts = new FlxTypedGroup<FlxText>();
add(dumbTexts);
textAnim = new FlxText(300, 16);
textAnim.size = 26;
textAnim.scrollFactor.set();
add(textAnim);
genBoyOffsets();
camFollow = new FlxObject(0, 0, 2, 2);
camFollow.screenCenter();
add(camFollow);
FlxG.camera.follow(camFollow);
super.create();
}
function genBoyOffsets(pushList:Bool = true):Void
{
var daLoop:Int = 0;
for (anim => offsets in char.animOffsets)
{
var text:FlxText = new FlxText(10, 20 + (18 * daLoop), 0, anim + ": " + offsets, 15);
text.scrollFactor.set();
text.color = FlxColor.BLUE;
dumbTexts.add(text);
if (pushList)
animList.push(anim);
daLoop++;
}
}
function updateTexts():Void
{
dumbTexts.forEach(function(text:FlxText)
{
text.kill();
dumbTexts.remove(text, true);
});
}
override function update(elapsed:Float)
{
textAnim.text = char.animation.curAnim.name;
if (FlxG.keys.justPressed.E)
FlxG.camera.zoom += 0.25;
if (FlxG.keys.justPressed.Q)
FlxG.camera.zoom -= 0.25;
if (FlxG.keys.pressed.I || FlxG.keys.pressed.J || FlxG.keys.pressed.K || FlxG.keys.pressed.L)
{
if (FlxG.keys.pressed.I)
camFollow.velocity.y = -90;
else if (FlxG.keys.pressed.K)
camFollow.velocity.y = 90;
else
camFollow.velocity.y = 0;
if (FlxG.keys.pressed.J)
camFollow.velocity.x = -90;
else if (FlxG.keys.pressed.L)
camFollow.velocity.x = 90;
else
camFollow.velocity.x = 0;
}
else
{
camFollow.velocity.set();
}
if (FlxG.keys.justPressed.W)
{
curAnim -= 1;
}
if (FlxG.keys.justPressed.S)
{
curAnim += 1;
}
if (curAnim < 0)
curAnim = animList.length - 1;
if (curAnim >= animList.length)
curAnim = 0;
if (FlxG.keys.justPressed.S || FlxG.keys.justPressed.W || FlxG.keys.justPressed.SPACE)
{
char.playAnim(animList[curAnim]);
updateTexts();
genBoyOffsets(false);
}
var upP = FlxG.keys.anyJustPressed([UP]);
var rightP = FlxG.keys.anyJustPressed([RIGHT]);
var downP = FlxG.keys.anyJustPressed([DOWN]);
var leftP = FlxG.keys.anyJustPressed([LEFT]);
var holdShift = FlxG.keys.pressed.SHIFT;
var multiplier = 1;
if (holdShift)
multiplier = 10;
if (upP || rightP || downP || leftP)
{
updateTexts();
if (upP)
char.animOffsets.get(animList[curAnim])[1] += 1 * multiplier;
if (downP)
char.animOffsets.get(animList[curAnim])[1] -= 1 * multiplier;
if (leftP)
char.animOffsets.get(animList[curAnim])[0] += 1 * multiplier;
if (rightP)
char.animOffsets.get(animList[curAnim])[0] -= 1 * multiplier;
updateTexts();
genBoyOffsets(false);
char.playAnim(animList[curAnim]);
}
super.update(elapsed);
}
}

View File

@ -0,0 +1,30 @@
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class BackgroundDancer extends FlxSprite
{
public function new(x:Float, y:Float)
{
super(x, y);
frames = Paths.getSparrowAtlas("limo/limoDancer",'week4');
animation.addByIndices('danceLeft', 'bg dancer sketch PINK', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'bg dancer sketch PINK', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.play('danceLeft');
antialiasing = true;
}
var danceDir:Bool = false;
public function dance():Void
{
danceDir = !danceDir;
if (danceDir)
animation.play('danceRight', true);
else
animation.play('danceLeft', true);
}
}

View File

@ -0,0 +1,39 @@
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class BackgroundGirls extends FlxSprite
{
public function new(x:Float, y:Float)
{
super(x, y);
// BG fangirls dissuaded
frames = Paths.getSparrowAtlas('weeb/bgFreaks','week6');
animation.addByIndices('danceLeft', 'BG girls group', CoolUtil.numberArray(14), "", 24, false);
animation.addByIndices('danceRight', 'BG girls group', CoolUtil.numberArray(30, 15), "", 24, false);
animation.play('danceLeft');
}
var danceDir:Bool = false;
public function getScared():Void
{
animation.addByIndices('danceLeft', 'BG fangirls dissuaded', CoolUtil.numberArray(14), "", 24, false);
animation.addByIndices('danceRight', 'BG fangirls dissuaded', CoolUtil.numberArray(30, 15), "", 24, false);
dance();
}
public function dance():Void
{
danceDir = !danceDir;
if (danceDir)
animation.play('danceRight', true);
else
animation.play('danceLeft', true);
}
}

View File

@ -0,0 +1,34 @@
package;
import flixel.util.FlxColor;
import openfl.display.ShaderParameter;
typedef BlendModeShader =
{
var uBlendColor:ShaderParameter<Float>;
}
class BlendModeEffect
{
public var shader(default, null):BlendModeShader;
@:isVar
public var color(default, set):FlxColor;
public function new(shader:BlendModeShader, color:FlxColor):Void
{
shader.uBlendColor.value = [];
this.shader = shader;
this.color = color;
}
function set_color(color:FlxColor):FlxColor
{
shader.uBlendColor.value[0] = color.redFloat;
shader.uBlendColor.value[1] = color.greenFloat;
shader.uBlendColor.value[2] = color.blueFloat;
shader.uBlendColor.value[3] = color.alphaFloat;
return this.color = color;
}
}

View File

@ -0,0 +1,43 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.util.FlxTimer;
using StringTools;
class Boyfriend extends Character
{
public var stunned:Bool = false;
public function new(x:Float, y:Float, ?char:String = 'bf')
{
super(x, y, char, true);
}
override function update(elapsed:Float)
{
if (!debugMode)
{
if (animation.curAnim.name.startsWith('sing'))
{
holdTimer += elapsed;
}
else
holdTimer = 0;
if (animation.curAnim.name.endsWith('miss') && animation.curAnim.finished && !debugMode)
{
playAnim('idle', true, false, 10);
}
if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished)
{
playAnim('deathLoop');
}
}
super.update(elapsed);
}
}

View File

@ -0,0 +1,11 @@
package;
import flixel.FlxSubState;
class ButtonRemapSubstate extends FlxSubState
{
public function new()
{
super();
}
}

128
source - Copy/Caching.hx Normal file
View File

@ -0,0 +1,128 @@
package;
import haxe.Exception;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import sys.FileSystem;
import sys.io.File;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import flixel.text.FlxText;
using StringTools;
class Caching extends MusicBeatState
{
var toBeDone = 0;
var done = 0;
var text:FlxText;
var kadeLogo:FlxSprite;
override function create()
{
FlxG.mouse.visible = false;
FlxG.worldBounds.set(0,0);
text = new FlxText(FlxG.width / 2, FlxG.height / 2 + 300,0,"Loading...");
text.size = 34;
text.alignment = FlxTextAlign.CENTER;
text.alpha = 0;
kadeLogo = new FlxSprite(FlxG.width / 2, FlxG.height / 2).loadGraphic(Paths.image('KadeEngineLogo'));
kadeLogo.x -= kadeLogo.width / 2;
kadeLogo.y -= kadeLogo.height / 2 + 100;
text.y -= kadeLogo.height / 2 - 125;
text.x -= 170;
kadeLogo.setGraphicSize(Std.int(kadeLogo.width * 0.6));
kadeLogo.alpha = 0;
add(kadeLogo);
add(text);
trace('starting caching..');
sys.thread.Thread.create(() -> {
cache();
});
super.create();
}
var calledDone = false;
override function update(elapsed)
{
if (toBeDone != 0 && done != toBeDone)
{
var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100;
kadeLogo.alpha = alpha;
text.alpha = alpha;
text.text = "Loading... (" + done + "/" + toBeDone + ")";
}
super.update(elapsed);
}
function cache()
{
var images = [];
var music = [];
trace("caching images...");
for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters")))
{
if (!i.endsWith(".png"))
continue;
images.push(i);
}
trace("caching music...");
for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/songs")))
{
music.push(i);
}
toBeDone = Lambda.count(images) + Lambda.count(music);
trace("LOADING: " + toBeDone + " OBJECTS.");
for (i in images)
{
var replaced = i.replace(".png","");
FlxG.bitmap.add(Paths.image("characters/" + replaced,"shared"));
trace("cached " + replaced);
done++;
}
for (i in music)
{
FlxG.sound.cache(Paths.inst(i));
FlxG.sound.cache(Paths.voices(i));
trace("cached " + i);
done++;
}
trace("Finished caching...");
FlxG.switchState(new TitleState());
}
}

660
source - Copy/Character.hx Normal file
View File

@ -0,0 +1,660 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.animation.FlxBaseAnimation;
import flixel.graphics.frames.FlxAtlasFrames;
using StringTools;
class Character extends FlxSprite
{
public var animOffsets:Map<String, Array<Dynamic>>;
public var debugMode:Bool = false;
public var isPlayer:Bool = false;
public var curCharacter:String = 'bf';
public var holdTimer:Float = 0;
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
{
super(x, y);
animOffsets = new Map<String, Array<Dynamic>>();
curCharacter = character;
this.isPlayer = isPlayer;
var tex:FlxAtlasFrames;
antialiasing = true;
switch (curCharacter)
{
case 'gf':
// GIRLFRIEND CODE
tex = Paths.getSparrowAtlas('characters/GF_assets');
frames = tex;
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
animation.addByPrefix('singRIGHT', 'GF Right Note', 24, false);
animation.addByPrefix('singUP', 'GF Up Note', 24, false);
animation.addByPrefix('singDOWN', 'GF Down Note', 24, false);
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.addByIndices('hairBlow', "GF Dancing Beat Hair blowing", [0, 1, 2, 3], "", 24);
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
animation.addByPrefix('scared', 'GF FEAR', 24);
addOffset('cheer');
addOffset('sad', -2, -2);
addOffset('danceLeft', 0, -9);
addOffset('danceRight', 0, -9);
addOffset("singUP", 0, 4);
addOffset("singRIGHT", 0, -20);
addOffset("singLEFT", 0, -19);
addOffset("singDOWN", 0, -20);
addOffset('hairBlow', 45, -8);
addOffset('hairFall', 0, -9);
addOffset('scared', -2, -17);
playAnim('danceRight');
case 'gf-christmas':
tex = Paths.getSparrowAtlas('characters/gfChristmas');
frames = tex;
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
animation.addByPrefix('singRIGHT', 'GF Right Note', 24, false);
animation.addByPrefix('singUP', 'GF Up Note', 24, false);
animation.addByPrefix('singDOWN', 'GF Down Note', 24, false);
animation.addByIndices('sad', 'gf sad', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "", 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
animation.addByIndices('hairBlow', "GF Dancing Beat Hair blowing", [0, 1, 2, 3], "", 24);
animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false);
animation.addByPrefix('scared', 'GF FEAR', 24);
addOffset('cheer');
addOffset('sad', -2, -2);
addOffset('danceLeft', 0, -9);
addOffset('danceRight', 0, -9);
addOffset("singUP", 0, 4);
addOffset("singRIGHT", 0, -20);
addOffset("singLEFT", 0, -19);
addOffset("singDOWN", 0, -20);
addOffset('hairBlow', 45, -8);
addOffset('hairFall', 0, -9);
addOffset('scared', -2, -17);
playAnim('danceRight');
case 'gf-car':
tex = Paths.getSparrowAtlas('characters/gfCar');
frames = tex;
animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false);
animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF Dancing Beat Hair blowing CAR', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24,
false);
addOffset('danceLeft', 0);
addOffset('danceRight', 0);
playAnim('danceRight');
case 'gf-pixel':
tex = Paths.getSparrowAtlas('characters/gfPixel');
frames = tex;
animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false);
animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
animation.addByIndices('danceRight', 'GF IDLE', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
addOffset('danceLeft', 0);
addOffset('danceRight', 0);
playAnim('danceRight');
setGraphicSize(Std.int(width * PlayState.daPixelZoom));
updateHitbox();
antialiasing = false;
case 'dad':
// DAD ANIMATION LOADING CODE
tex = Paths.getSparrowAtlas('characters/DADDY_DEAREST', 'shared');
frames = tex;
animation.addByPrefix('idle', 'Dad idle dance', 24);
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
animation.addByPrefix('singRIGHT', 'Dad Sing Note RIGHT', 24);
animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24);
animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24);
addOffset('idle');
addOffset("singUP", -6, 50);
addOffset("singRIGHT", 0, 27);
addOffset("singLEFT", -10, 10);
addOffset("singDOWN", 0, -30);
playAnim('idle');
case 'spooky':
tex = Paths.getSparrowAtlas('characters/spooky_kids_assets');
frames = tex;
animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false);
animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false);
animation.addByPrefix('singLEFT', 'note sing left', 24, false);
animation.addByPrefix('singRIGHT', 'spooky sing right', 24, false);
animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false);
animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false);
addOffset('danceLeft');
addOffset('danceRight');
addOffset("singUP", -20, 26);
addOffset("singRIGHT", -130, -14);
addOffset("singLEFT", 130, -10);
addOffset("singDOWN", -50, -130);
playAnim('danceRight');
case 'mom':
tex = Paths.getSparrowAtlas('characters/Mom_Assets');
frames = tex;
animation.addByPrefix('idle', "Mom Idle", 24, false);
animation.addByPrefix('singUP', "Mom Up Pose", 24, false);
animation.addByPrefix('singDOWN', "MOM DOWN POSE", 24, false);
animation.addByPrefix('singLEFT', 'Mom Left Pose', 24, false);
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
// CUZ DAVE IS DUMB!
animation.addByPrefix('singRIGHT', 'Mom Pose Left', 24, false);
addOffset('idle');
addOffset("singUP", 14, 71);
addOffset("singRIGHT", 10, -60);
addOffset("singLEFT", 250, -23);
addOffset("singDOWN", 20, -160);
playAnim('idle');
case 'mom-car':
tex = Paths.getSparrowAtlas('characters/momCar');
frames = tex;
animation.addByPrefix('idle', "Mom Idle", 24, false);
animation.addByPrefix('singUP', "Mom Up Pose", 24, false);
animation.addByPrefix('singDOWN', "MOM DOWN POSE", 24, false);
animation.addByPrefix('singLEFT', 'Mom Left Pose', 24, false);
// ANIMATION IS CALLED MOM LEFT POSE BUT ITS FOR THE RIGHT
// CUZ DAVE IS DUMB!
animation.addByPrefix('singRIGHT', 'Mom Pose Left', 24, false);
addOffset('idle');
addOffset("singUP", 14, 71);
addOffset("singRIGHT", 10, -60);
addOffset("singLEFT", 250, -23);
addOffset("singDOWN", 20, -160);
playAnim('idle');
case 'monster':
tex = Paths.getSparrowAtlas('characters/Monster_Assets');
frames = tex;
animation.addByPrefix('idle', 'monster idle', 24, false);
animation.addByPrefix('singUP', 'monster up note', 24, false);
animation.addByPrefix('singDOWN', 'monster down', 24, false);
animation.addByPrefix('singLEFT', 'Monster left note', 24, false);
animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false);
addOffset('idle');
addOffset("singUP", -20, 50);
addOffset("singRIGHT", -51);
addOffset("singLEFT", -30);
addOffset("singDOWN", -30, -40);
playAnim('idle');
case 'monster-christmas':
tex = Paths.getSparrowAtlas('characters/monsterChristmas');
frames = tex;
animation.addByPrefix('idle', 'monster idle', 24, false);
animation.addByPrefix('singUP', 'monster up note', 24, false);
animation.addByPrefix('singDOWN', 'monster down', 24, false);
animation.addByPrefix('singLEFT', 'Monster left note', 24, false);
animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false);
addOffset('idle');
addOffset("singUP", -20, 50);
addOffset("singRIGHT", -51);
addOffset("singLEFT", -30);
addOffset("singDOWN", -40, -94);
playAnim('idle');
case 'pico':
tex = Paths.getSparrowAtlas('characters/Pico_FNF_assetss');
frames = tex;
animation.addByPrefix('idle', "Pico Idle Dance", 24);
animation.addByPrefix('singUP', 'pico Up note0', 24, false);
animation.addByPrefix('singDOWN', 'Pico Down Note0', 24, false);
if (isPlayer)
{
animation.addByPrefix('singLEFT', 'Pico NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'Pico Note Right0', 24, false);
animation.addByPrefix('singRIGHTmiss', 'Pico Note Right Miss', 24, false);
animation.addByPrefix('singLEFTmiss', 'Pico NOTE LEFT miss', 24, false);
}
else
{
// Need to be flipped! REDO THIS LATER!
animation.addByPrefix('singLEFT', 'Pico Note Right0', 24, false);
animation.addByPrefix('singRIGHT', 'Pico NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHTmiss', 'Pico NOTE LEFT miss', 24, false);
animation.addByPrefix('singLEFTmiss', 'Pico Note Right Miss', 24, false);
}
animation.addByPrefix('singUPmiss', 'pico Up note miss', 24);
animation.addByPrefix('singDOWNmiss', 'Pico Down Note MISS', 24);
addOffset('idle');
addOffset("singUP", -29, 27);
addOffset("singRIGHT", -68, -7);
addOffset("singLEFT", 65, 9);
addOffset("singDOWN", 200, -70);
addOffset("singUPmiss", -19, 67);
addOffset("singRIGHTmiss", -60, 41);
addOffset("singLEFTmiss", 62, 64);
addOffset("singDOWNmiss", 210, -28);
playAnim('idle');
flipX = true;
case 'bf':
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND', 'shared');
frames = tex;
trace(tex.frames.length);
animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
animation.addByPrefix('hey', 'BF HEY', 24, false);
animation.addByPrefix('firstDeath', "BF dies", 24, false);
animation.addByPrefix('deathLoop', "BF Dead Loop", 24, true);
animation.addByPrefix('deathConfirm', "BF Dead confirm", 24, false);
animation.addByPrefix('scared', 'BF idle shaking', 24);
addOffset('idle', -5);
addOffset("singUP", -29, 27);
addOffset("singRIGHT", -38, -7);
addOffset("singLEFT", 12, -6);
addOffset("singDOWN", -10, -50);
addOffset("singUPmiss", -29, 27);
addOffset("singRIGHTmiss", -30, 21);
addOffset("singLEFTmiss", 12, 24);
addOffset("singDOWNmiss", -11, -19);
addOffset("hey", 7, 4);
addOffset('firstDeath', 37, 11);
addOffset('deathLoop', 37, 5);
addOffset('deathConfirm', 37, 69);
addOffset('scared', -4);
playAnim('idle');
flipX = true;
case 'bf-christmas':
var tex = Paths.getSparrowAtlas('characters/bfChristmas');
frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
animation.addByPrefix('hey', 'BF HEY', 24, false);
addOffset('idle', -5);
addOffset("singUP", -29, 27);
addOffset("singRIGHT", -38, -7);
addOffset("singLEFT", 12, -6);
addOffset("singDOWN", -10, -50);
addOffset("singUPmiss", -29, 27);
addOffset("singRIGHTmiss", -30, 21);
addOffset("singLEFTmiss", 12, 24);
addOffset("singDOWNmiss", -11, -19);
addOffset("hey", 7, 4);
playAnim('idle');
flipX = true;
case 'bf-car':
var tex = Paths.getSparrowAtlas('characters/bfCar');
frames = tex;
animation.addByPrefix('idle', 'BF idle dance', 24, false);
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
animation.addByPrefix('singLEFT', 'BF NOTE LEFT0', 24, false);
animation.addByPrefix('singRIGHT', 'BF NOTE RIGHT0', 24, false);
animation.addByPrefix('singDOWN', 'BF NOTE DOWN0', 24, false);
animation.addByPrefix('singUPmiss', 'BF NOTE UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF NOTE LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false);
addOffset('idle', -5);
addOffset("singUP", -29, 27);
addOffset("singRIGHT", -38, -7);
addOffset("singLEFT", 12, -6);
addOffset("singDOWN", -10, -50);
addOffset("singUPmiss", -29, 27);
addOffset("singRIGHTmiss", -30, 21);
addOffset("singLEFTmiss", 12, 24);
addOffset("singDOWNmiss", -11, -19);
playAnim('idle');
flipX = true;
case 'bf-pixel':
frames = Paths.getSparrowAtlas('characters/bfPixel');
animation.addByPrefix('idle', 'BF IDLE', 24, false);
animation.addByPrefix('singUP', 'BF UP NOTE', 24, false);
animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false);
animation.addByPrefix('singRIGHT', 'BF RIGHT NOTE', 24, false);
animation.addByPrefix('singDOWN', 'BF DOWN NOTE', 24, false);
animation.addByPrefix('singUPmiss', 'BF UP MISS', 24, false);
animation.addByPrefix('singLEFTmiss', 'BF LEFT MISS', 24, false);
animation.addByPrefix('singRIGHTmiss', 'BF RIGHT MISS', 24, false);
animation.addByPrefix('singDOWNmiss', 'BF DOWN MISS', 24, false);
addOffset('idle');
addOffset("singUP");
addOffset("singRIGHT");
addOffset("singLEFT");
addOffset("singDOWN");
addOffset("singUPmiss");
addOffset("singRIGHTmiss");
addOffset("singLEFTmiss");
addOffset("singDOWNmiss");
setGraphicSize(Std.int(width * 6));
updateHitbox();
playAnim('idle');
width -= 100;
height -= 100;
antialiasing = false;
flipX = true;
case 'bf-pixel-dead':
frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD');
animation.addByPrefix('singUP', "BF Dies pixel", 24, false);
animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false);
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
animation.addByPrefix('deathConfirm', "RETRY CONFIRM", 24, false);
animation.play('firstDeath');
addOffset('firstDeath');
addOffset('deathLoop', -37);
addOffset('deathConfirm', -37);
playAnim('firstDeath');
// pixel bullshit
setGraphicSize(Std.int(width * 6));
updateHitbox();
antialiasing = false;
flipX = true;
case 'senpai':
frames = Paths.getSparrowAtlas('characters/senpai');
animation.addByPrefix('idle', 'Senpai Idle', 24, false);
animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false);
animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false);
animation.addByPrefix('singRIGHT', 'SENPAI RIGHT NOTE', 24, false);
animation.addByPrefix('singDOWN', 'SENPAI DOWN NOTE', 24, false);
addOffset('idle');
addOffset("singUP", 5, 37);
addOffset("singRIGHT");
addOffset("singLEFT", 40);
addOffset("singDOWN", 14);
playAnim('idle');
setGraphicSize(Std.int(width * 6));
updateHitbox();
antialiasing = false;
case 'senpai-angry':
frames = Paths.getSparrowAtlas('characters/senpai');
animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false);
animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false);
animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false);
animation.addByPrefix('singRIGHT', 'Angry Senpai RIGHT NOTE', 24, false);
animation.addByPrefix('singDOWN', 'Angry Senpai DOWN NOTE', 24, false);
addOffset('idle');
addOffset("singUP", 5, 37);
addOffset("singRIGHT");
addOffset("singLEFT", 40);
addOffset("singDOWN", 14);
playAnim('idle');
setGraphicSize(Std.int(width * 6));
updateHitbox();
antialiasing = false;
case 'spirit':
frames = Paths.getPackerAtlas('characters/spirit');
animation.addByPrefix('idle', "idle spirit_", 24, false);
animation.addByPrefix('singUP', "up_", 24, false);
animation.addByPrefix('singRIGHT', "right_", 24, false);
animation.addByPrefix('singLEFT', "left_", 24, false);
animation.addByPrefix('singDOWN', "spirit down_", 24, false);
addOffset('idle', -220, -280);
addOffset('singUP', -220, -240);
addOffset("singRIGHT", -220, -280);
addOffset("singLEFT", -200, -280);
addOffset("singDOWN", 170, 110);
setGraphicSize(Std.int(width * 6));
updateHitbox();
playAnim('idle');
antialiasing = false;
case 'parents-christmas':
frames = Paths.getSparrowAtlas('characters/mom_dad_christmas_assets');
animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false);
animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false);
animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false);
animation.addByPrefix('singLEFT', 'Parent Left Note Dad', 24, false);
animation.addByPrefix('singRIGHT', 'Parent Right Note Dad', 24, false);
animation.addByPrefix('singUP-alt', 'Parent Up Note Mom', 24, false);
animation.addByPrefix('singDOWN-alt', 'Parent Down Note Mom', 24, false);
animation.addByPrefix('singLEFT-alt', 'Parent Left Note Mom', 24, false);
animation.addByPrefix('singRIGHT-alt', 'Parent Right Note Mom', 24, false);
addOffset('idle');
addOffset("singUP", -47, 24);
addOffset("singRIGHT", -1, -23);
addOffset("singLEFT", -30, 16);
addOffset("singDOWN", -31, -29);
addOffset("singUP-alt", -47, 24);
addOffset("singRIGHT-alt", -1, -24);
addOffset("singLEFT-alt", -30, 15);
addOffset("singDOWN-alt", -30, -27);
playAnim('idle');
}
dance();
if (isPlayer)
{
flipX = !flipX;
// Doesn't flip for BF, since his are already in the right place???
if (!curCharacter.startsWith('bf'))
{
// var animArray
var oldRight = animation.getByName('singRIGHT').frames;
animation.getByName('singRIGHT').frames = animation.getByName('singLEFT').frames;
animation.getByName('singLEFT').frames = oldRight;
// IF THEY HAVE MISS ANIMATIONS??
if (animation.getByName('singRIGHTmiss') != null)
{
var oldMiss = animation.getByName('singRIGHTmiss').frames;
animation.getByName('singRIGHTmiss').frames = animation.getByName('singLEFTmiss').frames;
animation.getByName('singLEFTmiss').frames = oldMiss;
}
}
}
}
override function update(elapsed:Float)
{
if (!curCharacter.startsWith('bf'))
{
if (animation.curAnim.name.startsWith('sing'))
{
holdTimer += elapsed;
}
var dadVar:Float = 4;
if (curCharacter == 'dad')
dadVar = 6.1;
if (holdTimer >= Conductor.stepCrochet * dadVar * 0.001)
{
trace('dance');
dance();
holdTimer = 0;
}
}
switch (curCharacter)
{
case 'gf':
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
playAnim('danceRight');
}
super.update(elapsed);
}
private var danced:Bool = false;
/**
* FOR GF DANCING SHIT
*/
public function dance()
{
if (!debugMode)
{
switch (curCharacter)
{
case 'gf':
if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
case 'gf-christmas':
if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
case 'gf-car':
if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
case 'gf-pixel':
if (!animation.curAnim.name.startsWith('hair'))
{
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
}
case 'spooky':
danced = !danced;
if (danced)
playAnim('danceRight');
else
playAnim('danceLeft');
default:
playAnim('idle');
}
}
}
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
{
animation.play(AnimName, Force, Reversed, Frame);
var daOffset = animOffsets.get(AnimName);
if (animOffsets.exists(AnimName))
{
offset.set(daOffset[0], daOffset[1]);
}
else
offset.set(0, 0);
if (curCharacter == 'gf')
{
if (AnimName == 'singLEFT')
{
danced = true;
}
else if (AnimName == 'singRIGHT')
{
danced = false;
}
if (AnimName == 'singUP' || AnimName == 'singDOWN')
{
danced = !danced;
}
}
}
public function addOffset(name:String, x:Float = 0, y:Float = 0)
{
animOffsets[name] = [x, y];
}
}

View File

@ -0,0 +1,80 @@
package;
import flixel.util.FlxStringUtil;
using StringTools;
class ChartParser
{
static public function parse(songName:String, section:Int):Array<Dynamic>
{
var IMG_WIDTH:Int = 8;
var regex:EReg = new EReg("[ \t]*((\r\n)|\r|\n)[ \t]*", "g");
var csvData = FlxStringUtil.imageToCSV(Paths.file('data/' + songName + '/' + songName + '_section' + section + '.png'));
var lines:Array<String> = regex.split(csvData);
var rows:Array<String> = lines.filter(function(line) return line != "");
csvData.replace("\n", ',');
var heightInTiles = rows.length;
var widthInTiles = 0;
var row:Int = 0;
// LMAOOOO STOLE ALL THIS FROM FLXBASETILEMAP LOLOL
var dopeArray:Array<Int> = [];
while (row < heightInTiles)
{
var rowString = rows[row];
if (rowString.endsWith(","))
rowString = rowString.substr(0, rowString.length - 1);
var columns = rowString.split(",");
if (columns.length == 0)
{
heightInTiles--;
continue;
}
if (widthInTiles == 0)
{
widthInTiles = columns.length;
}
var column = 0;
var pushedInColumn:Bool = false;
while (column < widthInTiles)
{
// the current tile to be added:
var columnString = columns[column];
var curTile = Std.parseInt(columnString);
if (curTile == null)
throw 'String in row $row, column $column is not a valid integer: "$columnString"';
if (curTile == 1)
{
if (column < 4)
dopeArray.push(column + 1);
else
{
var tempCol = (column + 1) * -1;
tempCol += 4;
dopeArray.push(tempCol);
}
pushedInColumn = true;
}
column++;
}
if (!pushedInColumn)
dopeArray.push(0);
row++;
}
return dopeArray;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
package;
import Song.SwagSong;
import flixel.FlxG;
/**
* ...
* @author
*/
typedef BPMChangeEvent =
{
var stepTime:Int;
var songTime:Float;
var bpm:Float;
}
class Conductor
{
public static var bpm:Float = 100;
public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds
public static var stepCrochet:Float = crochet / 4; // steps in milliseconds
public static var songPosition:Float;
public static var lastSongPos:Float;
public static var offset:Float = 0;
public static var safeFrames:Int = 10;
public static var safeZoneOffset:Float = Math.floor((safeFrames / 60) * 1000); // is calculated in create(), is safeFrames in milliseconds
public static var timeScale:Float = Conductor.safeZoneOffset / 166;
public static var bpmChangeMap:Array<BPMChangeEvent> = [];
public function new()
{
}
public static function recalculateTimings()
{
Conductor.safeFrames = FlxG.save.data.frames;
Conductor.safeZoneOffset = Math.floor((Conductor.safeFrames / 60) * 1000);
Conductor.timeScale = Conductor.safeZoneOffset / 166;
}
public static function mapBPMChanges(song:SwagSong)
{
bpmChangeMap = [];
var curBPM:Float = song.bpm;
var totalSteps:Int = 0;
var totalPos:Float = 0;
for (i in 0...song.notes.length)
{
if(song.notes[i].changeBPM && song.notes[i].bpm != curBPM)
{
curBPM = song.notes[i].bpm;
var event:BPMChangeEvent = {
stepTime: totalSteps,
songTime: totalPos,
bpm: curBPM
};
bpmChangeMap.push(event);
}
var deltaSteps:Int = song.notes[i].lengthInSteps;
totalSteps += deltaSteps;
totalPos += ((60 / curBPM) * 1000 / 4) * deltaSteps;
}
trace("new BPM map BUDDY " + bpmChangeMap);
}
public static function changeBPM(newBpm:Float)
{
bpm = newBpm;
crochet = ((60 / bpm) * 1000);
stepCrochet = crochet / 4;
}
}

762
source - Copy/Controls.hx Normal file
View File

@ -0,0 +1,762 @@
package;
import flixel.FlxG;
import flixel.input.FlxInput;
import flixel.input.actions.FlxAction;
import flixel.input.actions.FlxActionInput;
import flixel.input.actions.FlxActionInputDigital;
import flixel.input.actions.FlxActionManager;
import flixel.input.actions.FlxActionSet;
import flixel.input.gamepad.FlxGamepadButton;
import flixel.input.gamepad.FlxGamepadInputID;
import flixel.input.keyboard.FlxKey;
#if (haxe >= "4.0.0")
enum abstract Action(String) to String from String
{
var UP = "up";
var LEFT = "left";
var RIGHT = "right";
var DOWN = "down";
var UP_P = "up-press";
var LEFT_P = "left-press";
var RIGHT_P = "right-press";
var DOWN_P = "down-press";
var UP_R = "up-release";
var LEFT_R = "left-release";
var RIGHT_R = "right-release";
var DOWN_R = "down-release";
var ACCEPT = "accept";
var BACK = "back";
var PAUSE = "pause";
var RESET = "reset";
var CHEAT = "cheat";
}
#else
@:enum
abstract Action(String) to String from String
{
var UP = "up";
var LEFT = "left";
var RIGHT = "right";
var DOWN = "down";
var UP_P = "up-press";
var LEFT_P = "left-press";
var RIGHT_P = "right-press";
var DOWN_P = "down-press";
var UP_R = "up-release";
var LEFT_R = "left-release";
var RIGHT_R = "right-release";
var DOWN_R = "down-release";
var ACCEPT = "accept";
var BACK = "back";
var PAUSE = "pause";
var RESET = "reset";
var CHEAT = "cheat";
}
#end
enum Device
{
Keys;
Gamepad(id:Int);
}
/**
* Since, in many cases multiple actions should use similar keys, we don't want the
* rebinding UI to list every action. ActionBinders are what the user percieves as
* an input so, for instance, they can't set jump-press and jump-release to different keys.
*/
enum Control
{
UP;
LEFT;
RIGHT;
DOWN;
RESET;
ACCEPT;
BACK;
PAUSE;
CHEAT;
}
enum KeyboardScheme
{
Solo;
Duo(first:Bool);
None;
Custom;
}
/**
* A list of actions that a player would invoke via some input device.
* Uses FlxActions to funnel various inputs to a single action.
*/
class Controls extends FlxActionSet
{
var _up = new FlxActionDigital(Action.UP);
var _left = new FlxActionDigital(Action.LEFT);
var _right = new FlxActionDigital(Action.RIGHT);
var _down = new FlxActionDigital(Action.DOWN);
var _upP = new FlxActionDigital(Action.UP_P);
var _leftP = new FlxActionDigital(Action.LEFT_P);
var _rightP = new FlxActionDigital(Action.RIGHT_P);
var _downP = new FlxActionDigital(Action.DOWN_P);
var _upR = new FlxActionDigital(Action.UP_R);
var _leftR = new FlxActionDigital(Action.LEFT_R);
var _rightR = new FlxActionDigital(Action.RIGHT_R);
var _downR = new FlxActionDigital(Action.DOWN_R);
var _accept = new FlxActionDigital(Action.ACCEPT);
var _back = new FlxActionDigital(Action.BACK);
var _pause = new FlxActionDigital(Action.PAUSE);
var _reset = new FlxActionDigital(Action.RESET);
var _cheat = new FlxActionDigital(Action.CHEAT);
#if (haxe >= "4.0.0")
var byName:Map<String, FlxActionDigital> = [];
#else
var byName:Map<String, FlxActionDigital> = new Map<String, FlxActionDigital>();
#end
public var gamepadsAdded:Array<Int> = [];
public var keyboardScheme = KeyboardScheme.None;
public var UP(get, never):Bool;
inline function get_UP()
return _up.check();
public var LEFT(get, never):Bool;
inline function get_LEFT()
return _left.check();
public var RIGHT(get, never):Bool;
inline function get_RIGHT()
return _right.check();
public var DOWN(get, never):Bool;
inline function get_DOWN()
return _down.check();
public var UP_P(get, never):Bool;
inline function get_UP_P()
return _upP.check();
public var LEFT_P(get, never):Bool;
inline function get_LEFT_P()
return _leftP.check();
public var RIGHT_P(get, never):Bool;
inline function get_RIGHT_P()
return _rightP.check();
public var DOWN_P(get, never):Bool;
inline function get_DOWN_P()
return _downP.check();
public var UP_R(get, never):Bool;
inline function get_UP_R()
return _upR.check();
public var LEFT_R(get, never):Bool;
inline function get_LEFT_R()
return _leftR.check();
public var RIGHT_R(get, never):Bool;
inline function get_RIGHT_R()
return _rightR.check();
public var DOWN_R(get, never):Bool;
inline function get_DOWN_R()
return _downR.check();
public var ACCEPT(get, never):Bool;
inline function get_ACCEPT()
return _accept.check();
public var BACK(get, never):Bool;
inline function get_BACK()
return _back.check();
public var PAUSE(get, never):Bool;
inline function get_PAUSE()
return _pause.check();
public var RESET(get, never):Bool;
inline function get_RESET()
return _reset.check();
public var CHEAT(get, never):Bool;
inline function get_CHEAT()
return _cheat.check();
#if (haxe >= "4.0.0")
public function new(name, scheme = None)
{
super(name);
add(_up);
add(_left);
add(_right);
add(_down);
add(_upP);
add(_leftP);
add(_rightP);
add(_downP);
add(_upR);
add(_leftR);
add(_rightR);
add(_downR);
add(_accept);
add(_back);
add(_pause);
add(_reset);
add(_cheat);
for (action in digitalActions)
byName[action.name] = action;
setKeyboardScheme(scheme, false);
}
#else
public function new(name, scheme:KeyboardScheme = null)
{
super(name);
add(_up);
add(_left);
add(_right);
add(_down);
add(_upP);
add(_leftP);
add(_rightP);
add(_downP);
add(_upR);
add(_leftR);
add(_rightR);
add(_downR);
add(_accept);
add(_back);
add(_pause);
add(_reset);
add(_cheat);
for (action in digitalActions)
byName[action.name] = action;
if (scheme == null)
scheme = None;
setKeyboardScheme(scheme, false);
}
#end
override function update()
{
super.update();
}
// inline
public function checkByName(name:Action):Bool
{
#if debug
if (!byName.exists(name))
throw 'Invalid name: $name';
#end
return byName[name].check();
}
public function getDialogueName(action:FlxActionDigital):String
{
var input = action.inputs[0];
return switch input.device
{
case KEYBOARD: return '[${(input.inputID : FlxKey)}]';
case GAMEPAD: return '(${(input.inputID : FlxGamepadInputID)})';
case device: throw 'unhandled device: $device';
}
}
public function getDialogueNameFromToken(token:String):String
{
return getDialogueName(getActionFromControl(Control.createByName(token.toUpperCase())));
}
function getActionFromControl(control:Control):FlxActionDigital
{
return switch (control)
{
case UP: _up;
case DOWN: _down;
case LEFT: _left;
case RIGHT: _right;
case ACCEPT: _accept;
case BACK: _back;
case PAUSE: _pause;
case RESET: _reset;
case CHEAT: _cheat;
}
}
static function init():Void
{
var actions = new FlxActionManager();
FlxG.inputs.add(actions);
}
/**
* Calls a function passing each action bound by the specified control
* @param control
* @param func
* @return ->Void)
*/
function forEachBound(control:Control, func:FlxActionDigital->FlxInputState->Void)
{
switch (control)
{
case UP:
func(_up, PRESSED);
func(_upP, JUST_PRESSED);
func(_upR, JUST_RELEASED);
case LEFT:
func(_left, PRESSED);
func(_leftP, JUST_PRESSED);
func(_leftR, JUST_RELEASED);
case RIGHT:
func(_right, PRESSED);
func(_rightP, JUST_PRESSED);
func(_rightR, JUST_RELEASED);
case DOWN:
func(_down, PRESSED);
func(_downP, JUST_PRESSED);
func(_downR, JUST_RELEASED);
case ACCEPT:
func(_accept, JUST_PRESSED);
case BACK:
func(_back, JUST_PRESSED);
case PAUSE:
func(_pause, JUST_PRESSED);
case RESET:
func(_reset, JUST_PRESSED);
case CHEAT:
func(_cheat, JUST_PRESSED);
}
}
public function replaceBinding(control:Control, device:Device, ?toAdd:Int, ?toRemove:Int)
{
if (toAdd == toRemove)
return;
switch (device)
{
case Keys:
if (toRemove != null)
unbindKeys(control, [toRemove]);
if (toAdd != null)
bindKeys(control, [toAdd]);
case Gamepad(id):
if (toRemove != null)
unbindButtons(control, id, [toRemove]);
if (toAdd != null)
bindButtons(control, id, [toAdd]);
}
}
public function copyFrom(controls:Controls, ?device:Device)
{
#if (haxe >= "4.0.0")
for (name => action in controls.byName)
{
for (input in action.inputs)
{
if (device == null || isDevice(input, device))
byName[name].add(cast input);
}
}
#else
for (name in controls.byName.keys())
{
var action = controls.byName[name];
for (input in action.inputs)
{
if (device == null || isDevice(input, device))
byName[name].add(cast input);
}
}
#end
switch (device)
{
case null:
// add all
#if (haxe >= "4.0.0")
for (gamepad in controls.gamepadsAdded)
if (!gamepadsAdded.contains(gamepad))
gamepadsAdded.push(gamepad);
#else
for (gamepad in controls.gamepadsAdded)
if (gamepadsAdded.indexOf(gamepad) == -1)
gamepadsAdded.push(gamepad);
#end
mergeKeyboardScheme(controls.keyboardScheme);
case Gamepad(id):
gamepadsAdded.push(id);
case Keys:
mergeKeyboardScheme(controls.keyboardScheme);
}
}
inline public function copyTo(controls:Controls, ?device:Device)
{
controls.copyFrom(this, device);
}
function mergeKeyboardScheme(scheme:KeyboardScheme):Void
{
if (scheme != None)
{
switch (keyboardScheme)
{
case None:
keyboardScheme = scheme;
default:
keyboardScheme = Custom;
}
}
}
/**
* Sets all actions that pertain to the binder to trigger when the supplied keys are used.
* If binder is a literal you can inline this
*/
public function bindKeys(control:Control, keys:Array<FlxKey>)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addKeys(action, keys, state));
#else
forEachBound(control, function(action, state) addKeys(action, keys, state));
#end
}
/**
* Sets all actions that pertain to the binder to trigger when the supplied keys are used.
* If binder is a literal you can inline this
*/
public function unbindKeys(control:Control, keys:Array<FlxKey>)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeKeys(action, keys));
#else
forEachBound(control, function(action, _) removeKeys(action, keys));
#end
}
inline static function addKeys(action:FlxActionDigital, keys:Array<FlxKey>, state:FlxInputState)
{
for (key in keys)
action.addKey(key, state);
}
static function removeKeys(action:FlxActionDigital, keys:Array<FlxKey>)
{
var i = action.inputs.length;
while (i-- > 0)
{
var input = action.inputs[i];
if (input.device == KEYBOARD && keys.indexOf(cast input.inputID) != -1)
action.remove(input);
}
}
public function setKeyboardScheme(scheme:KeyboardScheme, reset = true)
{
loadKeyBinds();
/*if (reset)
removeKeyboard();
keyboardScheme = scheme;
#if (haxe >= "4.0.0")
switch (scheme)
{
case Solo:
inline bindKeys(Control.UP, [FlxKey.fromString("W"), FlxKey.UP]);
inline bindKeys(Control.DOWN, [FlxKey.fromString("S"), FlxKey.DOWN]);
inline bindKeys(Control.LEFT, [FlxKey.fromString("A"), FlxKey.LEFT]);
inline bindKeys(Control.RIGHT, [FlxKey.fromString("D"), FlxKey.RIGHT]);
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
inline bindKeys(Control.RESET, [FlxKey.fromString("R")]);
case Duo(true):
inline bindKeys(Control.UP, [W, K]);
inline bindKeys(Control.DOWN, [S, J]);
inline bindKeys(Control.LEFT, [A, H]);
inline bindKeys(Control.RIGHT, [D, L]);
inline bindKeys(Control.ACCEPT, [Z]);
inline bindKeys(Control.BACK, [X]);
inline bindKeys(Control.PAUSE, [ONE]);
inline bindKeys(Control.RESET, [R]);
case Duo(false):
inline bindKeys(Control.UP, [FlxKey.UP]);
inline bindKeys(Control.DOWN, [FlxKey.DOWN]);
inline bindKeys(Control.LEFT, [FlxKey.LEFT]);
inline bindKeys(Control.RIGHT, [FlxKey.RIGHT]);
inline bindKeys(Control.ACCEPT, [O]);
inline bindKeys(Control.BACK, [P]);
inline bindKeys(Control.PAUSE, [ENTER]);
inline bindKeys(Control.RESET, [BACKSPACE]);
case None: // nothing
case Custom: // nothing
}
#else
switch (scheme)
{
case Solo:
bindKeys(Control.UP, [W, K, FlxKey.UP]);
bindKeys(Control.DOWN, [S, J, FlxKey.DOWN]);
bindKeys(Control.LEFT, [A, H, FlxKey.LEFT]);
bindKeys(Control.RIGHT, [D, L, FlxKey.RIGHT]);
bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
bindKeys(Control.RESET, [R]);
case Duo(true):
bindKeys(Control.UP, [W, K]);
bindKeys(Control.DOWN, [S, J]);
bindKeys(Control.LEFT, [A, H]);
bindKeys(Control.RIGHT, [D, L]);
bindKeys(Control.ACCEPT, [Z]);
bindKeys(Control.BACK, [X]);
bindKeys(Control.PAUSE, [ONE]);
bindKeys(Control.RESET, [R]);
case Duo(false):
bindKeys(Control.UP, [FlxKey.UP]);
bindKeys(Control.DOWN, [FlxKey.DOWN]);
bindKeys(Control.LEFT, [FlxKey.LEFT]);
bindKeys(Control.RIGHT, [FlxKey.RIGHT]);
bindKeys(Control.ACCEPT, [O]);
bindKeys(Control.BACK, [P]);
bindKeys(Control.PAUSE, [ENTER]);
bindKeys(Control.RESET, [BACKSPACE]);
case None: // nothing
case Custom: // nothing
}
#end*/
}
public function loadKeyBinds()
{
//trace(FlxKey.fromString(FlxG.save.data.upBind));
removeKeyboard();
KeyBinds.keyCheck();
inline bindKeys(Control.UP, [FlxKey.fromString(FlxG.save.data.upBind), FlxKey.UP]);
inline bindKeys(Control.DOWN, [FlxKey.fromString(FlxG.save.data.downBind), FlxKey.DOWN]);
inline bindKeys(Control.LEFT, [FlxKey.fromString(FlxG.save.data.leftBind), FlxKey.LEFT]);
inline bindKeys(Control.RIGHT, [FlxKey.fromString(FlxG.save.data.rightBind), FlxKey.RIGHT]);
inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
inline bindKeys(Control.RESET, [FlxKey.fromString(FlxG.save.data.killBind)]);
}
function removeKeyboard()
{
for (action in this.digitalActions)
{
var i = action.inputs.length;
while (i-- > 0)
{
var input = action.inputs[i];
if (input.device == KEYBOARD)
action.remove(input);
}
}
}
public function addGamepad(id:Int, ?buttonMap:Map<Control, Array<FlxGamepadInputID>>):Void
{
gamepadsAdded.push(id);
#if (haxe >= "4.0.0")
for (control => buttons in buttonMap)
inline bindButtons(control, id, buttons);
#else
for (control in buttonMap.keys())
bindButtons(control, id, buttonMap[control]);
#end
}
inline function addGamepadLiteral(id:Int, ?buttonMap:Map<Control, Array<FlxGamepadInputID>>):Void
{
gamepadsAdded.push(id);
#if (haxe >= "4.0.0")
for (control => buttons in buttonMap)
inline bindButtons(control, id, buttons);
#else
for (control in buttonMap.keys())
bindButtons(control, id, buttonMap[control]);
#end
}
public function removeGamepad(deviceID:Int = FlxInputDeviceID.ALL):Void
{
for (action in this.digitalActions)
{
var i = action.inputs.length;
while (i-- > 0)
{
var input = action.inputs[i];
if (input.device == GAMEPAD && (deviceID == FlxInputDeviceID.ALL || input.deviceID == deviceID))
action.remove(input);
}
}
gamepadsAdded.remove(deviceID);
}
public function addDefaultGamepad(id):Void
{
#if !switch
addGamepadLiteral(id, [
Control.ACCEPT => [A],
Control.BACK => [B],
Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP],
Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN],
Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT],
Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT],
Control.PAUSE => [START],
Control.RESET => [Y]
]);
#else
addGamepadLiteral(id, [
//Swap A and B for switch
Control.ACCEPT => [B],
Control.BACK => [A],
Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP, RIGHT_STICK_DIGITAL_UP],
Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN, RIGHT_STICK_DIGITAL_DOWN],
Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT, RIGHT_STICK_DIGITAL_LEFT],
Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT, RIGHT_STICK_DIGITAL_RIGHT],
Control.PAUSE => [START],
//Swap Y and X for switch
Control.RESET => [Y],
Control.CHEAT => [X]
]);
#end
}
/**
* Sets all actions that pertain to the binder to trigger when the supplied keys are used.
* If binder is a literal you can inline this
*/
public function bindButtons(control:Control, id, buttons)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addButtons(action, buttons, state, id));
#else
forEachBound(control, function(action, state) addButtons(action, buttons, state, id));
#end
}
/**
* Sets all actions that pertain to the binder to trigger when the supplied keys are used.
* If binder is a literal you can inline this
*/
public function unbindButtons(control:Control, gamepadID:Int, buttons)
{
#if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons));
#else
forEachBound(control, function(action, _) removeButtons(action, gamepadID, buttons));
#end
}
inline static function addButtons(action:FlxActionDigital, buttons:Array<FlxGamepadInputID>, state, id)
{
for (button in buttons)
action.addGamepad(button, state, id);
}
static function removeButtons(action:FlxActionDigital, gamepadID:Int, buttons:Array<FlxGamepadInputID>)
{
var i = action.inputs.length;
while (i-- > 0)
{
var input = action.inputs[i];
if (isGamepad(input, gamepadID) && buttons.indexOf(cast input.inputID) != -1)
action.remove(input);
}
}
public function getInputsFor(control:Control, device:Device, ?list:Array<Int>):Array<Int>
{
if (list == null)
list = [];
switch (device)
{
case Keys:
for (input in getActionFromControl(control).inputs)
{
if (input.device == KEYBOARD)
list.push(input.inputID);
}
case Gamepad(id):
for (input in getActionFromControl(control).inputs)
{
if (input.deviceID == id)
list.push(input.inputID);
}
}
return list;
}
public function removeDevice(device:Device)
{
switch (device)
{
case Keys:
setKeyboardScheme(None);
case Gamepad(id):
removeGamepad(id);
}
}
static function isDevice(input:FlxActionInput, device:Device)
{
return switch device
{
case Keys: input.device == KEYBOARD;
case Gamepad(id): isGamepad(input, id);
}
}
inline static function isGamepad(input:FlxActionInput, deviceID:Int)
{
return input.device == GAMEPAD && (deviceID == FlxInputDeviceID.ALL || input.deviceID == deviceID);
}
}

View File

@ -0,0 +1,12 @@
package;
import flixel.FlxSprite;
import flixel.FlxSubState;
class ControlsSubState extends FlxSubState
{
public function new()
{
super();
}
}

View File

@ -0,0 +1,21 @@
class ConvertScore
{
public static function convertScore(noteDiff:Float):Int
{
var daRating:String = Ratings.CalculateRating(noteDiff, 166);
switch(daRating)
{
case 'shit':
return -300;
case 'bad':
return 0;
case 'good':
return 200;
case 'sick':
return 350;
}
return 0;
}
}

49
source - Copy/CoolUtil.hx Normal file
View File

@ -0,0 +1,49 @@
package;
import lime.utils.Assets;
using StringTools;
class CoolUtil
{
public static var difficultyArray:Array<String> = ['Easy', "Normal", "Hard"];
public static function difficultyFromInt(difficulty:Int):String
{
return difficultyArray[difficulty];
}
public static function coolTextFile(path:String):Array<String>
{
var daList:Array<String> = Assets.getText(path).trim().split('\n');
for (i in 0...daList.length)
{
daList[i] = daList[i].trim();
}
return daList;
}
public static function coolStringFile(path:String):Array<String>
{
var daList:Array<String> = path.trim().split('\n');
for (i in 0...daList.length)
{
daList[i] = daList[i].trim();
}
return daList;
}
public static function numberArray(max:Int, ?min = 0):Array<Int>
{
var dumbArray:Array<Int> = [];
for (i in min...max)
{
dumbArray.push(i);
}
return dumbArray;
}
}

View File

@ -0,0 +1,260 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.text.FlxTypeText;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup;
import flixel.input.FlxKeyManager;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
using StringTools;
class DialogueBox extends FlxSpriteGroup
{
var box:FlxSprite;
var curCharacter:String = '';
var dialogue:Alphabet;
var dialogueList:Array<String> = [];
// SECOND DIALOGUE FOR THE PIXEL SHIT INSTEAD???
var swagDialogue:FlxTypeText;
var dropText:FlxText;
public var finishThing:Void->Void;
var portraitLeft:FlxSprite;
var portraitRight:FlxSprite;
var handSelect:FlxSprite;
var bgFade:FlxSprite;
public function new(talkingRight:Bool = true, ?dialogueList:Array<String>)
{
super();
switch (PlayState.SONG.song.toLowerCase())
{
case 'senpai':
FlxG.sound.playMusic(Paths.music('Lunchbox'), 0);
FlxG.sound.music.fadeIn(1, 0, 0.8);
case 'thorns':
FlxG.sound.playMusic(Paths.music('LunchboxScary'), 0);
FlxG.sound.music.fadeIn(1, 0, 0.8);
}
bgFade = new FlxSprite(-200, -200).makeGraphic(Std.int(FlxG.width * 1.3), Std.int(FlxG.height * 1.3), 0xFFB3DFd8);
bgFade.scrollFactor.set();
bgFade.alpha = 0;
add(bgFade);
new FlxTimer().start(0.83, function(tmr:FlxTimer)
{
bgFade.alpha += (1 / 5) * 0.7;
if (bgFade.alpha > 0.7)
bgFade.alpha = 0.7;
}, 5);
box = new FlxSprite(-20, 45);
var hasDialog = false;
switch (PlayState.SONG.song.toLowerCase())
{
case 'senpai':
hasDialog = true;
box.frames = Paths.getSparrowAtlas('weeb/pixelUI/dialogueBox-pixel');
box.animation.addByPrefix('normalOpen', 'Text Box Appear', 24, false);
box.animation.addByIndices('normal', 'Text Box Appear', [4], "", 24);
case 'roses':
hasDialog = true;
FlxG.sound.play(Paths.sound('ANGRY_TEXT_BOX'));
box.frames = Paths.getSparrowAtlas('weeb/pixelUI/dialogueBox-senpaiMad');
box.animation.addByPrefix('normalOpen', 'SENPAI ANGRY IMPACT SPEECH', 24, false);
box.animation.addByIndices('normal', 'SENPAI ANGRY IMPACT SPEECH', [4], "", 24);
case 'thorns':
hasDialog = true;
box.frames = Paths.getSparrowAtlas('weeb/pixelUI/dialogueBox-evil');
box.animation.addByPrefix('normalOpen', 'Spirit Textbox spawn', 24, false);
box.animation.addByIndices('normal', 'Spirit Textbox spawn', [11], "", 24);
var face:FlxSprite = new FlxSprite(320, 170).loadGraphic(Paths.image('weeb/spiritFaceForward'));
face.setGraphicSize(Std.int(face.width * 6));
add(face);
}
this.dialogueList = dialogueList;
if (!hasDialog)
return;
portraitLeft = new FlxSprite(-20, 40);
portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait');
portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false);
portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9));
portraitLeft.updateHitbox();
portraitLeft.scrollFactor.set();
add(portraitLeft);
portraitLeft.visible = false;
portraitRight = new FlxSprite(0, 40);
portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait');
portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false);
portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9));
portraitRight.updateHitbox();
portraitRight.scrollFactor.set();
add(portraitRight);
portraitRight.visible = false;
box.animation.play('normalOpen');
box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9));
box.updateHitbox();
add(box);
box.screenCenter(X);
portraitLeft.screenCenter(X);
handSelect = new FlxSprite(FlxG.width * 0.9, FlxG.height * 0.9).loadGraphic(Paths.image('weeb/pixelUI/hand_textbox'));
add(handSelect);
if (!talkingRight)
{
// box.flipX = true;
}
dropText = new FlxText(242, 502, Std.int(FlxG.width * 0.6), "", 32);
dropText.font = 'Pixel Arial 11 Bold';
dropText.color = 0xFFD89494;
add(dropText);
swagDialogue = new FlxTypeText(240, 500, Std.int(FlxG.width * 0.6), "", 32);
swagDialogue.font = 'Pixel Arial 11 Bold';
swagDialogue.color = 0xFF3F2021;
swagDialogue.sounds = [FlxG.sound.load(Paths.sound('pixelText'), 0.6)];
add(swagDialogue);
dialogue = new Alphabet(0, 80, "", false, true);
// dialogue.x = 90;
// add(dialogue);
}
var dialogueOpened:Bool = false;
var dialogueStarted:Bool = false;
override function update(elapsed:Float)
{
// HARD CODING CUZ IM STUPDI
if (PlayState.SONG.song.toLowerCase() == 'roses')
portraitLeft.visible = false;
if (PlayState.SONG.song.toLowerCase() == 'thorns')
{
portraitLeft.color = FlxColor.BLACK;
swagDialogue.color = FlxColor.WHITE;
dropText.color = FlxColor.BLACK;
}
dropText.text = swagDialogue.text;
if (box.animation.curAnim != null)
{
if (box.animation.curAnim.name == 'normalOpen' && box.animation.curAnim.finished)
{
box.animation.play('normal');
dialogueOpened = true;
}
}
if (dialogueOpened && !dialogueStarted)
{
startDialogue();
dialogueStarted = true;
}
if (FlxG.keys.justPressed.ANY && dialogueStarted == true)
{
remove(dialogue);
FlxG.sound.play(Paths.sound('clickText'), 0.8);
if (dialogueList[1] == null && dialogueList[0] != null)
{
if (!isEnding)
{
isEnding = true;
if (PlayState.SONG.song.toLowerCase() == 'senpai' || PlayState.SONG.song.toLowerCase() == 'thorns')
FlxG.sound.music.fadeOut(2.2, 0);
new FlxTimer().start(0.2, function(tmr:FlxTimer)
{
box.alpha -= 1 / 5;
bgFade.alpha -= 1 / 5 * 0.7;
portraitLeft.visible = false;
portraitRight.visible = false;
swagDialogue.alpha -= 1 / 5;
dropText.alpha = swagDialogue.alpha;
}, 5);
new FlxTimer().start(1.2, function(tmr:FlxTimer)
{
finishThing();
kill();
});
}
}
else
{
dialogueList.remove(dialogueList[0]);
startDialogue();
}
}
super.update(elapsed);
}
var isEnding:Bool = false;
function startDialogue():Void
{
cleanDialog();
// var theDialog:Alphabet = new Alphabet(0, 70, dialogueList[0], false, true);
// dialogue = theDialog;
// add(theDialog);
// swagDialogue.text = ;
swagDialogue.resetText(dialogueList[0]);
swagDialogue.start(0.04, true);
switch (curCharacter)
{
case 'dad':
portraitRight.visible = false;
if (!portraitLeft.visible)
{
portraitLeft.visible = true;
portraitLeft.animation.play('enter');
}
case 'bf':
portraitLeft.visible = false;
if (!portraitRight.visible)
{
portraitRight.visible = true;
portraitRight.animation.play('enter');
}
}
}
function cleanDialog():Void
{
var splitName:Array<String> = dialogueList[0].split(":");
curCharacter = splitName[1];
dialogueList[0] = dialogueList[0].substr(splitName[1].length + 2).trim();
}
}

89
source - Copy/Discord.hx Normal file
View File

@ -0,0 +1,89 @@
package;
#if windows
import Sys.sleep;
import discord_rpc.DiscordRpc;
using StringTools;
class DiscordClient
{
public function new()
{
trace("Discord Client starting...");
DiscordRpc.start({
clientID: "557069829501091850", // change this to what ever the fuck you want lol
onReady: onReady,
onError: onError,
onDisconnected: onDisconnected
});
trace("Discord Client started.");
while (true)
{
DiscordRpc.process();
sleep(2);
//trace("Discord Client Update");
}
DiscordRpc.shutdown();
}
public static function shutdown()
{
DiscordRpc.shutdown();
}
static function onReady()
{
DiscordRpc.presence({
details: "In the Menus",
state: null,
largeImageKey: 'icon',
largeImageText: "fridaynightfunkin"
});
}
static function onError(_code:Int, _message:String)
{
trace('Error! $_code : $_message');
}
static function onDisconnected(_code:Int, _message:String)
{
trace('Disconnected! $_code : $_message');
}
public static function initialize()
{
var DiscordDaemon = sys.thread.Thread.create(() ->
{
new DiscordClient();
});
trace("Discord Client initialized");
}
public static function changePresence(details:String, state:Null<String>, ?smallImageKey : String, ?hasStartTimestamp : Bool, ?endTimestamp: Float)
{
var startTimestamp:Float = if(hasStartTimestamp) Date.now().getTime() else 0;
if (endTimestamp > 0)
{
endTimestamp = startTimestamp + endTimestamp;
}
DiscordRpc.presence({
details: details,
state: state,
largeImageKey: 'icon',
largeImageText: "fridaynightfunkin",
smallImageKey : smallImageKey,
// Obtained times are in milliseconds so they are divided so Discord can use it
startTimestamp : Std.int(startTimestamp / 1000),
endTimestamp : Std.int(endTimestamp / 1000)
});
//trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp');
}
}
#end

View File

@ -0,0 +1,84 @@
class EtternaFunctions
{
// erf constants
public static var a1 = 0.254829592;
public static var a2 = -0.284496736;
public static var a3 = 1.421413741;
public static var a4 = -1.453152027;
public static var a5 = 1.061405429;
public static var p = 0.3275911;
public static function erf(x:Float):Float
{
// Save the sign of x
var sign = 1;
if (x < 0)
sign = -1;
x = Math.abs(x);
// A&S formula 7.1.26
var t = 1.0/(1.0 + p*x);
var y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*Math.exp(-x*x);
return sign*y;
}
public static function getNotes():Int
{
var notes:Int = 0;
for (i in 0...PlayState.SONG.notes.length)
{
for (ii in 0...PlayState.SONG.notes[i].sectionNotes.length)
{
var n = PlayState.SONG.notes[i].sectionNotes[ii];
if (n[1] <= 0)
notes++;
}
}
return notes;
}
public static function getHolds():Int
{
var notes:Int = 0;
for (i in 0...PlayState.SONG.notes.length)
{
trace(PlayState.SONG.notes[i]);
for (ii in 0...PlayState.SONG.notes[i].sectionNotes.length)
{
var n = PlayState.SONG.notes[i].sectionNotes[ii];
trace(n);
if (n[1] > 0)
notes++;
}
}
return notes;
}
public static function getMapMaxScore():Int
{
return (getNotes() * 350);
}
public static function wife3(maxms:Float, ts:Float)
{
var max_points = 1.0;
var miss_weight = -5.5;
var ridic= 5 * ts;
var max_boo_weight = 180 * ts;
var ts_pow = 0.75;
var zero = 65 * (Math.pow(ts,ts_pow));
var power = 2.5;
var dev = 22.7 * (Math.pow(ts,ts_pow));
if (maxms <= ridic) // anything below this (judge scaled) threshold is counted as full pts
return max_points;
else if (maxms <= zero) // ma/pa region, exponential
return max_points * erf((zero - maxms) / dev);
else if (maxms <= max_boo_weight)// cb region, linear
return (maxms - zero) * miss_weight / (max_boo_weight - zero);
else
return miss_weight;
}
}

View File

@ -0,0 +1,332 @@
package;
import flash.text.TextField;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import lime.utils.Assets;
#if windows
import Discord.DiscordClient;
#end
using StringTools;
class FreeplayState extends MusicBeatState
{
var songs:Array<SongMetadata> = [];
var selector:FlxText;
var curSelected:Int = 0;
var curDifficulty:Int = 1;
var scoreText:FlxText;
var comboText:FlxText;
var diffText:FlxText;
var lerpScore:Int = 0;
var intendedScore:Int = 0;
var combo:String = '';
private var grpSongs:FlxTypedGroup<Alphabet>;
private var curPlaying:Bool = false;
private var iconArray:Array<HealthIcon> = [];
override function create()
{
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
for (i in 0...initSonglist.length)
{
var data:Array<String> = initSonglist[i].split(':');
songs.push(new SongMetadata(data[0], Std.parseInt(data[2]), data[1]));
}
/*
if (FlxG.sound.music != null)
{
if (!FlxG.sound.music.playing)
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}
*/
#if windows
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Freeplay Menu", null);
#end
var isDebug:Bool = false;
#if debug
isDebug = true;
#end
// LOAD MUSIC
// LOAD CHARACTERS
var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuBGBlue'));
add(bg);
grpSongs = new FlxTypedGroup<Alphabet>();
add(grpSongs);
for (i in 0...songs.length)
{
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false, true);
songText.isMenuItem = true;
songText.targetY = i;
grpSongs.add(songText);
var icon:HealthIcon = new HealthIcon(songs[i].songCharacter);
icon.sprTracker = songText;
// using a FlxGroup is too much fuss!
iconArray.push(icon);
add(icon);
// songText.x += 40;
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
// songText.screenCenter(X);
}
scoreText = new FlxText(FlxG.width * 0.7, 5, 0, "", 32);
// scoreText.autoSize = false;
scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT);
// scoreText.alignment = RIGHT;
var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 66, 0xFF000000);
scoreBG.alpha = 0.6;
add(scoreBG);
diffText = new FlxText(scoreText.x, scoreText.y + 36, 0, "", 24);
diffText.font = scoreText.font;
add(diffText);
comboText = new FlxText(diffText.x + 100, diffText.y, 0, "", 24);
comboText.font = diffText.font;
add(comboText);
add(scoreText);
changeSelection();
changeDiff();
// FlxG.sound.playMusic(Paths.music('title'), 0);
// FlxG.sound.music.fadeIn(2, 0, 0.8);
selector = new FlxText();
selector.size = 40;
selector.text = ">";
// add(selector);
var swag:Alphabet = new Alphabet(1, 0, "swag");
// JUST DOIN THIS SHIT FOR TESTING!!!
/*
var md:String = Markdown.markdownToHtml(Assets.getText('CHANGELOG.md'));
var texFel:TextField = new TextField();
texFel.width = FlxG.width;
texFel.height = FlxG.height;
// texFel.
texFel.htmlText = md;
FlxG.stage.addChild(texFel);
// scoreText.textField.htmlText = md;
trace(md);
*/
super.create();
}
public function addSong(songName:String, weekNum:Int, songCharacter:String)
{
songs.push(new SongMetadata(songName, weekNum, songCharacter));
}
public function addWeek(songs:Array<String>, weekNum:Int, ?songCharacters:Array<String>)
{
if (songCharacters == null)
songCharacters = ['dad'];
var num:Int = 0;
for (song in songs)
{
addSong(song, weekNum, songCharacters[num]);
if (songCharacters.length != 1)
num++;
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (FlxG.sound.music.volume < 0.7)
{
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
}
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.4));
if (Math.abs(lerpScore - intendedScore) <= 10)
lerpScore = intendedScore;
scoreText.text = "PERSONAL BEST:" + lerpScore;
comboText.text = combo + '\n';
var upP = controls.UP_P;
var downP = controls.DOWN_P;
var accepted = controls.ACCEPT;
if (upP)
{
changeSelection(-1);
}
if (downP)
{
changeSelection(1);
}
if (controls.LEFT_P)
changeDiff(-1);
if (controls.RIGHT_P)
changeDiff(1);
if (controls.BACK)
{
FlxG.switchState(new MainMenuState());
}
if (accepted)
{
// adjusting the song name to be compatible
var songFormat = StringTools.replace(songs[curSelected].songName, " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';
case 'Philly-Nice': songFormat = 'Philly';
}
trace(songs[curSelected].songName);
var poop:String = Highscore.formatSong(songFormat, curDifficulty);
trace(poop);
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty;
PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
}
}
function changeDiff(change:Int = 0)
{
curDifficulty += change;
if (curDifficulty < 0)
curDifficulty = 2;
if (curDifficulty > 2)
curDifficulty = 0;
// adjusting the highscore song name to be compatible (changeDiff)
var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
combo = Highscore.getCombo(songHighscore, curDifficulty);
#end
diffText.text = CoolUtil.difficultyFromInt(curDifficulty).toUpperCase();
}
function changeSelection(change:Int = 0)
{
#if !switch
// NGio.logEvent('Fresh');
#end
// NGio.logEvent('Fresh');
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
curSelected += change;
if (curSelected < 0)
curSelected = songs.length - 1;
if (curSelected >= songs.length)
curSelected = 0;
// selector.y = (70 * curSelected) + 30;
// adjusting the highscore song name to be compatible (changeSelection)
// would read original scores if we didn't change packages
var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-");
switch (songHighscore) {
case 'Dad-Battle': songHighscore = 'Dadbattle';
case 'Philly-Nice': songHighscore = 'Philly';
}
#if !switch
intendedScore = Highscore.getScore(songHighscore, curDifficulty);
combo = Highscore.getCombo(songHighscore, curDifficulty);
// lerpScore = 0;
#end
#if PRELOAD_ALL
FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
#end
var bullShit:Int = 0;
for (i in 0...iconArray.length)
{
iconArray[i].alpha = 0.6;
}
iconArray[curSelected].alpha = 1;
for (item in grpSongs.members)
{
item.targetY = bullShit - curSelected;
bullShit++;
item.alpha = 0.6;
// item.setGraphicSize(Std.int(item.width * 0.8));
if (item.targetY == 0)
{
item.alpha = 1;
// item.setGraphicSize(Std.int(item.width));
}
}
}
}
class SongMetadata
{
public var songName:String = "";
public var week:Int = 0;
public var songCharacter:String = "";
public function new(song:String, week:Int, songCharacter:String)
{
this.songName = song;
this.week = week;
this.songCharacter = songCharacter;
}
}

View File

@ -0,0 +1,7 @@
package;
class GameDimensions
{
public static var width:Int = 1280;
public static var height:Int = 720;
}

View File

@ -0,0 +1,82 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.input.gamepad.FlxGamepad;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
class GameOverState extends FlxTransitionableState
{
var bfX:Float = 0;
var bfY:Float = 0;
public function new(x:Float, y:Float)
{
super();
bfX = x;
bfY = y;
}
override function create()
{
var loser:FlxSprite = new FlxSprite(100, 100);
var loseTex = Paths.getSparrowAtlas('lose');
loser.frames = loseTex;
loser.animation.addByPrefix('lose', 'lose', 24, false);
loser.animation.play('lose');
add(loser);
var bf:Boyfriend = new Boyfriend(bfX, bfY);
// bf.scrollFactor.set();
add(bf);
bf.playAnim('firstDeath');
FlxG.camera.follow(bf, LOCKON, 0.001);
var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(Paths.image('restart'));
restart.setGraphicSize(Std.int(restart.width * 0.6));
restart.updateHitbox();
restart.alpha = 0;
restart.antialiasing = true;
add(restart);
FlxG.sound.music.fadeOut(2, FlxG.sound.music.volume * 0.6);
FlxTween.tween(restart, {alpha: 1}, 1, {ease: FlxEase.quartInOut});
FlxTween.tween(restart, {y: restart.y + 40}, 7, {ease: FlxEase.quartInOut, type: PINGPONG});
super.create();
}
private var fading:Bool = false;
override function update(elapsed:Float)
{
var pressed:Bool = FlxG.keys.justPressed.ANY;
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.ANY)
pressed = true;
}
pressed = false;
if (pressed && !fading)
{
fading = true;
FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween)
{
FlxG.sound.music.stop();
LoadingState.loadAndSwitchState(new PlayState());
});
}
super.update(elapsed);
}
}

View File

@ -0,0 +1,113 @@
package;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSubState;
import flixel.math.FlxPoint;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
class GameOverSubstate extends MusicBeatSubstate
{
var bf:Boyfriend;
var camFollow:FlxObject;
var stageSuffix:String = "";
public function new(x:Float, y:Float)
{
var daStage = PlayState.curStage;
var daBf:String = '';
switch (PlayState.SONG.player1)
{
case 'bf-pixel':
stageSuffix = '-pixel';
daBf = 'bf-pixel-dead';
default:
daBf = 'bf';
}
super();
Conductor.songPosition = 0;
bf = new Boyfriend(x, y, daBf);
add(bf);
camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1);
add(camFollow);
FlxG.sound.play(Paths.sound('fnf_loss_sfx' + stageSuffix));
Conductor.changeBPM(100);
// FlxG.camera.followLerp = 1;
// FlxG.camera.focusOn(FlxPoint.get(FlxG.width / 2, FlxG.height / 2));
FlxG.camera.scroll.set();
FlxG.camera.target = null;
bf.playAnim('firstDeath');
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (controls.ACCEPT)
{
endBullshit();
}
if (controls.BACK)
{
FlxG.sound.music.stop();
if (PlayState.isStoryMode)
FlxG.switchState(new StoryMenuState());
else
FlxG.switchState(new FreeplayState());
PlayState.loadRep = false;
}
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.curFrame == 12)
{
FlxG.camera.follow(camFollow, LOCKON, 0.01);
}
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished)
{
FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix));
}
if (FlxG.sound.music.playing)
{
Conductor.songPosition = FlxG.sound.music.time;
}
}
override function beatHit()
{
super.beatHit();
FlxG.log.add('beat');
}
var isEnding:Bool = false;
function endBullshit():Void
{
if (!isEnding)
{
isEnding = true;
bf.playAnim('deathConfirm', true);
FlxG.sound.music.stop();
FlxG.sound.play(Paths.music('gameOverEnd' + stageSuffix));
new FlxTimer().start(0.7, function(tmr:FlxTimer)
{
FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
{
LoadingState.loadAndSwitchState(new PlayState());
});
});
}
}
}

View File

@ -0,0 +1,255 @@
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.text.FlxText;
import flixel.math.FlxMath;
import flixel.FlxCamera;
import flixel.math.FlxPoint;
import flixel.FlxObject;
#if windows
import Discord.DiscordClient;
import sys.thread.Thread;
#end
import flixel.group.FlxGroup.FlxTypedGroup;
import openfl.ui.Keyboard;
import flixel.FlxSprite;
import flixel.FlxG;
class GameplayCustomizeState extends MusicBeatState
{
var defaultX:Float = FlxG.width * 0.55 - 135;
var defaultY:Float = FlxG.height / 2 - 50;
var background:FlxSprite;
var curt:FlxSprite;
var front:FlxSprite;
var sick:FlxSprite;
var text:FlxText;
var blackBorder:FlxSprite;
var bf:Boyfriend;
var dad:Character;
var strumLine:FlxSprite;
var strumLineNotes:FlxTypedGroup<FlxSprite>;
var playerStrums:FlxTypedGroup<FlxSprite>;
private var camHUD:FlxCamera;
public override function create() {
#if windows
// Updating Discord Rich Presence
DiscordClient.changePresence("Customizing Gameplay", null);
#end
sick = new FlxSprite().loadGraphic(Paths.image('sick','shared'));
sick.scrollFactor.set();
background = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback','shared'));
curt = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains','shared'));
front = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront','shared'));
Conductor.changeBPM(102);
persistentUpdate = true;
super.create();
camHUD = new FlxCamera();
camHUD.bgColor.alpha = 0;
FlxG.cameras.add(camHUD);
background.scrollFactor.set(0.9,0.9);
curt.scrollFactor.set(0.9,0.9);
front.scrollFactor.set(0.9,0.9);
add(background);
add(front);
add(curt);
var camFollow = new FlxObject(0, 0, 1, 1);
dad = new Character(100, 100, 'dad');
bf = new Boyfriend(770, 450, 'bf');
var camPos:FlxPoint = new FlxPoint(dad.getGraphicMidpoint().x + 400, dad.getGraphicMidpoint().y);
camFollow.setPosition(camPos.x, camPos.y);
add(bf);
add(dad);
add(sick);
add(camFollow);
FlxG.camera.follow(camFollow, LOCKON, 0.01);
// FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height);
FlxG.camera.zoom = 0.9;
FlxG.camera.focusOn(camFollow.getPosition());
strumLine = new FlxSprite(0, FlxG.save.data.strumline).makeGraphic(FlxG.width, 14);
strumLine.scrollFactor.set();
strumLine.alpha = 0.4;
add(strumLine);
if (FlxG.save.data.downscroll)
strumLine.y = FlxG.height - 165;
strumLineNotes = new FlxTypedGroup<FlxSprite>();
add(strumLineNotes);
playerStrums = new FlxTypedGroup<FlxSprite>();
sick.cameras = [camHUD];
strumLine.cameras = [camHUD];
playerStrums.cameras = [camHUD];
generateStaticArrows(0);
generateStaticArrows(1);
text = new FlxText(5, FlxG.height + 40, 0, "Drag around gameplay elements, R to reset, Escape to go back.", 12);
text.scrollFactor.set();
text.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
blackBorder = new FlxSprite(-30,FlxG.height + 40).makeGraphic((Std.int(text.width + 900)),Std.int(text.height + 600),FlxColor.BLACK);
blackBorder.alpha = 0.5;
add(blackBorder);
add(text);
FlxTween.tween(text,{y: FlxG.height - 18},2,{ease: FlxEase.elasticInOut});
FlxTween.tween(blackBorder,{y: FlxG.height - 18},2, {ease: FlxEase.elasticInOut});
if (!FlxG.save.data.changedHit)
{
FlxG.save.data.changedHitX = defaultX;
FlxG.save.data.changedHitY = defaultY;
}
sick.x = FlxG.save.data.changedHitX;
sick.y = FlxG.save.data.changedHitY;
FlxG.mouse.visible = true;
}
override function update(elapsed:Float) {
if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time;
super.update(elapsed);
FlxG.camera.zoom = FlxMath.lerp(0.9, FlxG.camera.zoom, 0.95);
camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95);
if (FlxG.mouse.overlaps(sick) && FlxG.mouse.pressed)
{
sick.x = FlxG.mouse.x - sick.width / 2;
sick.y = FlxG.mouse.y - sick.height;
}
for (i in playerStrums)
i.y = strumLine.y;
for (i in strumLineNotes)
i.y = strumLine.y;
if (FlxG.mouse.overlaps(sick) && FlxG.mouse.justReleased)
{
FlxG.save.data.changedHitX = sick.x;
FlxG.save.data.changedHitY = sick.y;
FlxG.save.data.changedHit = true;
}
if (FlxG.keys.justPressed.R)
{
sick.x = defaultX;
sick.y = defaultY;
FlxG.save.data.changedHitX = sick.x;
FlxG.save.data.changedHitY = sick.y;
FlxG.save.data.changedHit = false;
}
if (controls.BACK)
{
FlxG.mouse.visible = false;
FlxG.sound.play(Paths.sound('cancelMenu'));
FlxG.switchState(new OptionsMenu());
}
}
override function beatHit()
{
super.beatHit();
bf.playAnim('idle');
dad.dance();
FlxG.camera.zoom += 0.015;
camHUD.zoom += 0.010;
trace('beat');
}
// ripped from play state cuz im lazy
private function generateStaticArrows(player:Int):Void
{
for (i in 0...4)
{
// FlxG.log.add(i);
var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y);
babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets', 'shared');
babyArrow.animation.addByPrefix('green', 'arrowUP');
babyArrow.animation.addByPrefix('blue', 'arrowDOWN');
babyArrow.animation.addByPrefix('purple', 'arrowLEFT');
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
babyArrow.antialiasing = true;
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));
switch (Math.abs(i))
{
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.addByPrefix('static', 'arrowLEFT');
babyArrow.animation.addByPrefix('pressed', 'left press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.addByPrefix('static', 'arrowDOWN');
babyArrow.animation.addByPrefix('pressed', 'down press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false);
case 2:
babyArrow.x += Note.swagWidth * 2;
babyArrow.animation.addByPrefix('static', 'arrowUP');
babyArrow.animation.addByPrefix('pressed', 'up press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false);
case 3:
babyArrow.x += Note.swagWidth * 3;
babyArrow.animation.addByPrefix('static', 'arrowRIGHT');
babyArrow.animation.addByPrefix('pressed', 'right press', 24, false);
babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false);
}
babyArrow.updateHitbox();
babyArrow.scrollFactor.set();
babyArrow.ID = i;
if (player == 1)
playerStrums.add(babyArrow);
babyArrow.animation.play('static');
babyArrow.x += 50;
babyArrow.x += ((FlxG.width / 2) * player);
strumLineNotes.add(babyArrow);
}
}
}

View File

@ -0,0 +1,88 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class GitarooPause extends MusicBeatState
{
var replayButton:FlxSprite;
var cancelButton:FlxSprite;
var replaySelect:Bool = false;
public function new():Void
{
super();
}
override function create()
{
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('pauseAlt/pauseBG'));
add(bg);
var bf:FlxSprite = new FlxSprite(0, 30);
bf.frames = Paths.getSparrowAtlas('pauseAlt/bfLol');
bf.animation.addByPrefix('lol', "funnyThing", 13);
bf.animation.play('lol');
add(bf);
bf.screenCenter(X);
replayButton = new FlxSprite(FlxG.width * 0.28, FlxG.height * 0.7);
replayButton.frames = Paths.getSparrowAtlas('pauseAlt/pauseUI');
replayButton.animation.addByPrefix('selected', 'bluereplay', 0, false);
replayButton.animation.appendByPrefix('selected', 'yellowreplay');
replayButton.animation.play('selected');
add(replayButton);
cancelButton = new FlxSprite(FlxG.width * 0.58, replayButton.y);
cancelButton.frames = Paths.getSparrowAtlas('pauseAlt/pauseUI');
cancelButton.animation.addByPrefix('selected', 'bluecancel', 0, false);
cancelButton.animation.appendByPrefix('selected', 'cancelyellow');
cancelButton.animation.play('selected');
add(cancelButton);
changeThing();
super.create();
}
override function update(elapsed:Float)
{
if (controls.LEFT_P || controls.RIGHT_P)
changeThing();
if (controls.ACCEPT)
{
if (replaySelect)
{
FlxG.switchState(new PlayState());
}
else
{
FlxG.switchState(new MainMenuState());
}
}
super.update(elapsed);
}
function changeThing():Void
{
replaySelect = !replaySelect;
if (replaySelect)
{
cancelButton.animation.curAnim.curFrame = 0;
replayButton.animation.curAnim.curFrame = 1;
}
else
{
cancelButton.animation.curAnim.curFrame = 1;
replayButton.animation.curAnim.curFrame = 0;
}
}
}

View File

@ -0,0 +1,95 @@
package;
import openfl.Lib;
class GlobalVideo
{
private static var video:VideoHandler;
private static var webm:WebmHandler;
public static var isWebm:Bool = false;
public static var isAndroid:Bool = false;
public static var daAlpha1:Float = 0.2;
public static var daAlpha2:Float = 1;
public static function setVid(vid:VideoHandler):Void
{
video = vid;
}
public static function getVid():VideoHandler
{
return video;
}
public static function setWebm(vid:WebmHandler):Void
{
webm = vid;
isWebm = true;
}
public static function getWebm():WebmHandler
{
return webm;
}
public static function get():Dynamic
{
if (isWebm)
{
return getWebm();
} else {
return getVid();
}
}
public static function calc(ind:Int):Dynamic
{
var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight;
var width:Float = GameDimensions.width;
var height:Float = GameDimensions.height;
//trace("AH: " + stageWidth);
//trace(width);
var ratioX:Float = height / width;
var ratioY:Float = width / height;
var appliedWidth:Float = stageHeight * ratioY;
var appliedHeight:Float = stageWidth * ratioX;
//trace(appliedWidth);
var remainingX:Float = stageWidth - appliedWidth;
var remainingY:Float = stageHeight - appliedHeight;
remainingX = remainingX / 2;
remainingY = remainingY / 2;
appliedWidth = Std.int(appliedWidth);
appliedHeight = Std.int(appliedHeight);
if (appliedHeight > stageHeight)
{
remainingY = 0;
appliedHeight = stageHeight;
}
if (appliedWidth > stageWidth)
{
remainingX = 0;
appliedWidth = stageWidth;
}
switch(ind)
{
case 0:
return remainingX;
case 1:
return remainingY;
case 2:
return appliedWidth;
case 3:
return appliedHeight;
}
return null;
}
}

View File

@ -0,0 +1,58 @@
package;
import flixel.FlxSprite;
class HealthIcon extends FlxSprite
{
/**
* Used for FreeplayState! If you use it elsewhere, prob gonna annoying
*/
public var sprTracker:FlxSprite;
public function new(char:String = 'bf', isPlayer:Bool = false)
{
super();
loadGraphic(Paths.image('iconGrid'), true, 150, 150);
antialiasing = true;
animation.add('bf', [0, 1], 0, false, isPlayer);
animation.add('bf-car', [0, 1], 0, false, isPlayer);
animation.add('bf-christmas', [0, 1], 0, false, isPlayer);
animation.add('bf-pixel', [21, 21], 0, false, isPlayer);
animation.add('spooky', [2, 3], 0, false, isPlayer);
animation.add('pico', [4, 5], 0, false, isPlayer);
animation.add('mom', [6, 7], 0, false, isPlayer);
animation.add('mom-car', [6, 7], 0, false, isPlayer);
animation.add('tankman', [8, 9], 0, false, isPlayer);
animation.add('face', [10, 11], 0, false, isPlayer);
animation.add('dad', [12, 13], 0, false, isPlayer);
animation.add('senpai', [22, 22], 0, false, isPlayer);
animation.add('senpai-angry', [22, 22], 0, false, isPlayer);
animation.add('spirit', [23, 23], 0, false, isPlayer);
animation.add('bf-old', [14, 15], 0, false, isPlayer);
animation.add('gf', [16], 0, false, isPlayer);
animation.add('gf-christmas', [16], 0, false, isPlayer);
animation.add('gf-pixel', [16], 0, false, isPlayer);
animation.add('parents-christmas', [17, 18], 0, false, isPlayer);
animation.add('monster', [19, 20], 0, false, isPlayer);
animation.add('monster-christmas', [19, 20], 0, false, isPlayer);
animation.play(char);
switch(char)
{
case 'bf-pixel' | 'senpai' | 'senpai-angry' | 'spirit' | 'gf-pixel':
antialiasing = false;
}
scrollFactor.set();
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (sprTracker != null)
setPosition(sprTracker.x + sprTracker.width + 10, sprTracker.y - 30);
}
}

View File

@ -0,0 +1,15 @@
import flixel.math.FlxMath;
class HelperFunctions
{
public static function truncateFloat( number : Float, precision : Int): Float {
var num = number;
num = num * Math.pow(10, precision);
num = Math.round( num ) / Math.pow(10, precision);
return num;
}
public static function GCD(a, b) {
return b == 0 ? FlxMath.absInt(a) : GCD(b, a % b);
}
}

159
source - Copy/Highscore.hx Normal file
View File

@ -0,0 +1,159 @@
package;
import flixel.FlxG;
using StringTools;
class Highscore
{
#if (haxe >= "4.0.0")
public static var songScores:Map<String, Int> = new Map();
public static var songCombos:Map<String, String> = new Map();
#else
public static var songScores:Map<String, Int> = new Map<String, Int>();
public static var songCombos:Map<String, String> = new Map<String, String>();
#end
public static function saveScore(song:String, score:Int = 0, ?diff:Int = 0):Void
{
var daSong:String = formatSong(song, diff);
#if !switch
NGio.postScore(score, song);
#end
if(!FlxG.save.data.botplay)
{
if (songScores.exists(daSong))
{
if (songScores.get(daSong) < score)
setScore(daSong, score);
}
else
setScore(daSong, score);
}else trace('BotPlay detected. Score saving is disabled.');
}
public static function saveCombo(song:String, combo:String, ?diff:Int = 0):Void
{
var daSong:String = formatSong(song, diff);
var finalCombo:String = combo.split(')')[0].replace('(', '');
if(!FlxG.save.data.botplay)
{
if (songCombos.exists(daSong))
{
if (getComboInt(songCombos.get(daSong)) < getComboInt(finalCombo))
setCombo(daSong, finalCombo);
}
else
setCombo(daSong, finalCombo);
}
}
public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
{
#if !switch
NGio.postScore(score, "Week " + week);
#end
if(!FlxG.save.data.botplay)
{
var daWeek:String = formatSong('week' + week, diff);
if (songScores.exists(daWeek))
{
if (songScores.get(daWeek) < score)
setScore(daWeek, score);
}
else
setScore(daWeek, score);
}else trace('BotPlay detected. Score saving is disabled.');
}
/**
* YOU SHOULD FORMAT SONG WITH formatSong() BEFORE TOSSING IN SONG VARIABLE
*/
static function setScore(song:String, score:Int):Void
{
// Reminder that I don't need to format this song, it should come formatted!
songScores.set(song, score);
FlxG.save.data.songScores = songScores;
FlxG.save.flush();
}
static function setCombo(song:String, combo:String):Void
{
// Reminder that I don't need to format this song, it should come formatted!
songCombos.set(song, combo);
FlxG.save.data.songCombos = songCombos;
FlxG.save.flush();
}
public static function formatSong(song:String, diff:Int):String
{
var daSong:String = song;
if (diff == 0)
daSong += '-easy';
else if (diff == 2)
daSong += '-hard';
return daSong;
}
static function getComboInt(combo:String):Int
{
switch(combo)
{
case 'SDCB':
return 1;
case 'FC':
return 2;
case 'GFC':
return 3;
case 'MFC':
return 4;
default:
return 0;
}
}
public static function getScore(song:String, diff:Int):Int
{
if (!songScores.exists(formatSong(song, diff)))
setScore(formatSong(song, diff), 0);
return songScores.get(formatSong(song, diff));
}
public static function getCombo(song:String, diff:Int):String
{
if (!songCombos.exists(formatSong(song, diff)))
setCombo(formatSong(song, diff), '');
return songCombos.get(formatSong(song, diff));
}
public static function getWeekScore(week:Int, diff:Int):Int
{
if (!songScores.exists(formatSong('week' + week, diff)))
setScore(formatSong('week' + week, diff), 0);
return songScores.get(formatSong('week' + week, diff));
}
public static function load():Void
{
if (FlxG.save.data.songScores != null)
{
songScores = FlxG.save.data.songScores;
}
if (FlxG.save.data.songCombos != null)
{
songCombos = FlxG.save.data.songCombos;
}
}
}

279
source - Copy/HitGraph.hx Normal file
View File

@ -0,0 +1,279 @@
import flixel.FlxG;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.text.TextFieldAutoSize;
import flixel.system.FlxAssets;
import openfl.text.TextFormat;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormatAlign;
import flixel.math.FlxMath;
import flixel.util.FlxColor;
import flixel.util.FlxDestroyUtil;
/**
* stolen from https://github.com/HaxeFlixel/flixel/blob/master/flixel/system/debug/stats/StatsGraph.hx
*/
class HitGraph extends Sprite
{
static inline var AXIS_COLOR:FlxColor = 0xffffff;
static inline var AXIS_ALPHA:Float = 0.5;
inline static var HISTORY_MAX:Int = 30;
public var minLabel:TextField;
public var curLabel:TextField;
public var maxLabel:TextField;
public var avgLabel:TextField;
public var minValue:Float = -(Math.floor((PlayState.rep.replay.sf / 60) * 1000) + 95);
public var maxValue:Float = Math.floor((PlayState.rep.replay.sf / 60) * 1000) + 95;
public var showInput:Bool = FlxG.save.data.inputShow;
public var graphColor:FlxColor;
public var history:Array<Dynamic> = [];
public var bitmap:Bitmap;
var _axis:Shape;
var _width:Int;
var _height:Int;
var _unit:String;
var _labelWidth:Int;
var _label:String;
public function new(X:Int, Y:Int, Width:Int, Height:Int)
{
super();
x = X;
y = Y;
_width = Width;
_height = Height;
var bm = new BitmapData(Width,Height);
bm.draw(this);
bitmap = new Bitmap(bm);
_axis = new Shape();
_axis.x = _labelWidth + 10;
var ts = Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166;
var early = createTextField(10,10,FlxColor.WHITE,12);
var late = createTextField(10,_height - 20,FlxColor.WHITE,12);
early.text = "Early (" + -166 * ts + "ms)";
late.text = "Late (" + 166 * ts + "ms)";
addChild(early);
addChild(late);
addChild(_axis);
drawAxes();
}
/**
* Redraws the axes of the graph.
*/
function drawAxes():Void
{
var gfx = _axis.graphics;
gfx.clear();
gfx.lineStyle(1, AXIS_COLOR, AXIS_ALPHA);
// y-Axis
gfx.moveTo(0, 0);
gfx.lineTo(0, _height);
// x-Axis
gfx.moveTo(0, _height);
gfx.lineTo(_width, _height);
gfx.moveTo(0, _height / 2);
gfx.lineTo(_width, _height / 2);
}
public static function createTextField(X:Float = 0, Y:Float = 0, Color:FlxColor = FlxColor.WHITE, Size:Int = 12):TextField
{
return initTextField(new TextField(), X, Y, Color, Size);
}
public static function initTextField<T:TextField>(tf:T, X:Float = 0, Y:Float = 0, Color:FlxColor = FlxColor.WHITE, Size:Int = 12):T
{
tf.x = X;
tf.y = Y;
tf.multiline = false;
tf.wordWrap = false;
tf.embedFonts = true;
tf.selectable = false;
#if flash
tf.antiAliasType = AntiAliasType.NORMAL;
tf.gridFitType = GridFitType.PIXEL;
#end
tf.defaultTextFormat = new TextFormat("assets/fonts/vcr.ttf", Size, Color.to24Bit());
tf.alpha = Color.alphaFloat;
tf.autoSize = TextFieldAutoSize.LEFT;
return tf;
}
function drawJudgementLine(ms:Float):Void
{
var gfx:Graphics = graphics;
gfx.lineStyle(1, graphColor, 0.3);
var ts = Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166;
var range:Float = Math.max(maxValue - minValue, maxValue * 0.1);
var value = ((ms * ts) - minValue) / range;
var pointY = _axis.y + ((-value * _height - 1) + _height);
var graphX = _axis.x + 1;
if (ms == 45)
gfx.moveTo(graphX, _axis.y + pointY);
var graphX = _axis.x + 1;
gfx.drawRect(graphX,pointY, _width,1);
gfx.lineStyle(1, graphColor, 1);
}
/**
* Redraws the graph based on the values stored in the history.
*/
function drawGraph():Void
{
var gfx:Graphics = graphics;
gfx.clear();
gfx.lineStyle(1, graphColor, 1);
gfx.beginFill(0x00FF00);
drawJudgementLine(45);
gfx.endFill();
gfx.beginFill(0xFF0000);
drawJudgementLine(90);
gfx.endFill();
gfx.beginFill(0x8b0000);
drawJudgementLine(135);
gfx.endFill();
gfx.beginFill(0x580000);
drawJudgementLine(166);
gfx.endFill();
gfx.beginFill(0x00FF00);
drawJudgementLine(-45);
gfx.endFill();
gfx.beginFill(0xFF0000);
drawJudgementLine(-90);
gfx.endFill();
gfx.beginFill(0x8b0000);
drawJudgementLine(-135);
gfx.endFill();
gfx.beginFill(0x580000);
drawJudgementLine(-166);
gfx.endFill();
var range:Float = Math.max(maxValue - minValue, maxValue * 0.1);
var graphX = _axis.x + 1;
if (showInput)
{
for (i in 0...PlayState.rep.replay.ana.anaArray.length)
{
var ana = PlayState.rep.replay.ana.anaArray[i];
var value = (ana.key * 25 - minValue) / range;
if (ana.hit)
gfx.beginFill(0xFFFF00);
else
gfx.beginFill(0xC2B280);
if (ana.hitTime < 0)
continue;
var pointY = (-value * _height - 1) + _height;
gfx.drawRect(graphX + fitX(ana.hitTime), pointY,2,2);
gfx.endFill();
}
}
for (i in 0...history.length)
{
var value = (history[i][0] - minValue) / range;
var judge = history[i][1];
switch(judge)
{
case "sick":
gfx.beginFill(0x00FFFF);
case "good":
gfx.beginFill(0x00FF00);
case "bad":
gfx.beginFill(0xFF0000);
case "shit":
gfx.beginFill(0x8b0000);
case "miss":
gfx.beginFill(0x580000);
default:
gfx.beginFill(0xFFFFFF);
}
var pointY = (-value * _height - 1) + _height;
/*if (i == 0)
gfx.moveTo(graphX, _axis.y + pointY);*/
gfx.drawRect(graphX + fitX(history[i][2]), pointY,4,4);
gfx.endFill();
}
var bm = new BitmapData(_width,_height);
bm.draw(this);
bitmap = new Bitmap(bm);
}
public function fitX(x:Float)
{
return (x / FlxG.sound.music.length) * width;
}
public function addToHistory(diff:Float, judge:String, time:Float)
{
history.push([diff,judge, time]);
}
public function update():Void
{
drawGraph();
}
public function average():Float
{
var sum:Float = 0;
for (value in history)
sum += value;
return sum / history.length;
}
public function destroy():Void
{
_axis = FlxDestroyUtil.removeChild(this, _axis);
history = null;
}
}

View File

@ -0,0 +1,101 @@
import openfl.Lib;
import flixel.FlxG;
class KadeEngineData
{
public static function initSave()
{
if (FlxG.save.data.newInput == null)
FlxG.save.data.newInput = true;
if (FlxG.save.data.downscroll == null)
FlxG.save.data.downscroll = false;
if (FlxG.save.data.dfjk == null)
FlxG.save.data.dfjk = false;
if (FlxG.save.data.accuracyDisplay == null)
FlxG.save.data.accuracyDisplay = true;
if (FlxG.save.data.offset == null)
FlxG.save.data.offset = 0;
if (FlxG.save.data.songPosition == null)
FlxG.save.data.songPosition = false;
if (FlxG.save.data.fps == null)
FlxG.save.data.fps = false;
if (FlxG.save.data.changedHit == null)
{
FlxG.save.data.changedHitX = -1;
FlxG.save.data.changedHitY = -1;
FlxG.save.data.changedHit = false;
}
if (FlxG.save.data.fpsRain == null)
FlxG.save.data.fpsRain = false;
if (FlxG.save.data.fpsCap == null)
FlxG.save.data.fpsCap = 120;
if (FlxG.save.data.fpsCap > 285 || FlxG.save.data.fpsCap < 60)
FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine
if (FlxG.save.data.scrollSpeed == null)
FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.npsDisplay == null)
FlxG.save.data.npsDisplay = false;
if (FlxG.save.data.frames == null)
FlxG.save.data.frames = 10;
if (FlxG.save.data.accuracyMod == null)
FlxG.save.data.accuracyMod = 1;
if (FlxG.save.data.watermark == null)
FlxG.save.data.watermark = true;
if (FlxG.save.data.ghost == null)
FlxG.save.data.ghost = true;
if (FlxG.save.data.distractions == null)
FlxG.save.data.distractions = true;
if (FlxG.save.data.flashing == null)
FlxG.save.data.flashing = true;
if (FlxG.save.data.resetButton == null)
FlxG.save.data.resetButton = false;
if (FlxG.save.data.botplay == null)
FlxG.save.data.botplay = false;
if (FlxG.save.data.cpuStrums == null)
FlxG.save.data.cpuStrums = false;
if (FlxG.save.data.strumline == null)
FlxG.save.data.strumline = false;
if (FlxG.save.data.customStrumLine == null)
FlxG.save.data.customStrumLine = 0;
if (FlxG.save.data.camzoom == null)
FlxG.save.data.camzoom = true;
if (FlxG.save.data.scoreScreen == null)
FlxG.save.data.scoreScreen = true;
if (FlxG.save.data.inputShow == null)
FlxG.save.data.inputShow = false;
Conductor.recalculateTimings();
PlayerSettings.player1.controls.loadKeyBinds();
KeyBinds.keyCheck();
Main.watermarks = FlxG.save.data.watermark;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
}
}

View File

@ -0,0 +1,262 @@
package;
/// Code created by Rozebud for FPS Plus (thanks rozebud)
// modified by KadeDev for use in Kade Engine/Tricky
import flixel.util.FlxAxes;
import flixel.FlxSubState;
import Options.Option;
import flixel.input.FlxInput;
import flixel.input.keyboard.FlxKey;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.effects.FlxFlicker;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import io.newgrounds.NG;
import lime.app.Application;
import lime.utils.Assets;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.input.FlxKeyManager;
using StringTools;
class KeyBindMenu extends FlxSubState
{
var keyTextDisplay:FlxText;
var keyWarning:FlxText;
var warningTween:FlxTween;
var keyText:Array<String> = ["LEFT", "DOWN", "UP", "RIGHT"];
var defaultKeys:Array<String> = ["A", "S", "W", "D", "R"];
var curSelected:Int = 0;
var keys:Array<String> = [FlxG.save.data.leftBind,
FlxG.save.data.downBind,
FlxG.save.data.upBind,
FlxG.save.data.rightBind];
var tempKey:String = "";
var blacklist:Array<String> = ["ESCAPE", "ENTER", "BACKSPACE", "SPACE"];
var blackBox:FlxSprite;
var infoText:FlxText;
var state:String = "select";
override function create()
{
for (i in 0...keys.length)
{
var k = keys[i];
if (k == null)
keys[i] = defaultKeys[i];
}
//FlxG.sound.playMusic('assets/music/configurator' + TitleState.soundExt);
persistentUpdate = persistentDraw = true;
keyTextDisplay = new FlxText(-10, 0, 1280, "", 72);
keyTextDisplay.scrollFactor.set(0, 0);
keyTextDisplay.setFormat("VCR OSD Mono", 42, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
keyTextDisplay.borderSize = 2;
keyTextDisplay.borderQuality = 3;
blackBox = new FlxSprite(0,0).makeGraphic(FlxG.width,FlxG.height,FlxColor.BLACK);
add(blackBox);
infoText = new FlxText(-10, 580, 1280, "(Escape to save, backspace to leave without saving)", 72);
infoText.scrollFactor.set(0, 0);
infoText.setFormat("VCR OSD Mono", 24, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
infoText.borderSize = 2;
infoText.borderQuality = 3;
infoText.alpha = 0;
infoText.screenCenter(FlxAxes.X);
add(infoText);
add(keyTextDisplay);
blackBox.alpha = 0;
keyTextDisplay.alpha = 0;
FlxTween.tween(keyTextDisplay, {alpha: 1}, 1, {ease: FlxEase.expoInOut});
FlxTween.tween(infoText, {alpha: 1}, 1.4, {ease: FlxEase.expoInOut});
FlxTween.tween(blackBox, {alpha: 0.7}, 1, {ease: FlxEase.expoInOut});
OptionsMenu.instance.acceptInput = false;
textUpdate();
super.create();
}
override function update(elapsed:Float)
{
switch(state){
case "select":
if (FlxG.keys.justPressed.UP)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(-1);
}
if (FlxG.keys.justPressed.DOWN)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(1);
}
if (FlxG.keys.justPressed.ENTER){
FlxG.sound.play(Paths.sound('scrollMenu'));
state = "input";
}
else if(FlxG.keys.justPressed.ESCAPE){
quit();
}
else if (FlxG.keys.justPressed.BACKSPACE){
reset();
}
case "input":
tempKey = keys[curSelected];
keys[curSelected] = "?";
textUpdate();
state = "waiting";
case "waiting":
if(FlxG.keys.justPressed.ESCAPE){
keys[curSelected] = tempKey;
state = "select";
FlxG.sound.play(Paths.sound('confirmMenu'));
}
else if(FlxG.keys.justPressed.ENTER){
addKey(defaultKeys[curSelected]);
save();
state = "select";
}
else if(FlxG.keys.justPressed.ANY){
addKey(FlxG.keys.getIsDown()[0].ID.toString());
save();
state = "select";
}
case "exiting":
default:
state = "select";
}
if(FlxG.keys.justPressed.ANY)
textUpdate();
super.update(elapsed);
}
function textUpdate(){
keyTextDisplay.text = "\n\n";
for(i in 0...4){
var textStart = (i == curSelected) ? "> " : " ";
keyTextDisplay.text += textStart + keyText[i] + ": " + ((keys[i] != keyText[i]) ? (keys[i] + " / ") : "" ) + keyText[i] + " ARROW\n";
}
keyTextDisplay.screenCenter();
}
function save(){
FlxG.save.data.upBind = keys[2];
FlxG.save.data.downBind = keys[1];
FlxG.save.data.leftBind = keys[0];
FlxG.save.data.rightBind = keys[3];
FlxG.save.flush();
PlayerSettings.player1.controls.loadKeyBinds();
}
function reset(){
for(i in 0...5){
keys[i] = defaultKeys[i];
}
quit();
}
function quit(){
state = "exiting";
save();
OptionsMenu.instance.acceptInput = true;
FlxTween.tween(keyTextDisplay, {alpha: 0}, 1, {ease: FlxEase.expoInOut});
FlxTween.tween(blackBox, {alpha: 0}, 1.1, {ease: FlxEase.expoInOut, onComplete: function(flx:FlxTween){close();}});
FlxTween.tween(infoText, {alpha: 0}, 1, {ease: FlxEase.expoInOut});
}
function addKey(r:String){
var shouldReturn:Bool = true;
var notAllowed:Array<String> = [];
for(x in blacklist){notAllowed.push(x);}
trace(notAllowed);
for(x in 0...keys.length)
{
var oK = keys[x];
if(oK == r)
keys[x] = null;
if (notAllowed.contains(oK))
return;
}
if(shouldReturn){
keys[curSelected] = r;
FlxG.sound.play(Paths.sound('scrollMenu'));
}
else{
keys[curSelected] = tempKey;
FlxG.sound.play(Paths.sound('scrollMenu'));
keyWarning.alpha = 1;
warningTween.cancel();
warningTween = FlxTween.tween(keyWarning, {alpha: 0}, 0.5, {ease: FlxEase.circOut, startDelay: 2});
}
}
function changeItem(_amount:Int = 0)
{
curSelected += _amount;
if (curSelected > 3)
curSelected = 0;
if (curSelected < 0)
curSelected = 3;
}
}

50
source - Copy/KeyBinds.hx Normal file
View File

@ -0,0 +1,50 @@
import flixel.FlxG;
import flixel.input.FlxInput;
import flixel.input.actions.FlxAction;
import flixel.input.actions.FlxActionInput;
import flixel.input.actions.FlxActionInputDigital;
import flixel.input.actions.FlxActionManager;
import flixel.input.actions.FlxActionSet;
import flixel.input.gamepad.FlxGamepadButton;
import flixel.input.gamepad.FlxGamepadInputID;
import flixel.input.keyboard.FlxKey;
class KeyBinds
{
public static function resetBinds():Void{
FlxG.save.data.upBind = "W";
FlxG.save.data.downBind = "S";
FlxG.save.data.leftBind = "A";
FlxG.save.data.rightBind = "D";
FlxG.save.data.killBind = "R";
PlayerSettings.player1.controls.loadKeyBinds();
}
public static function keyCheck():Void
{
if(FlxG.save.data.upBind == null){
FlxG.save.data.upBind = "W";
trace("No UP");
}
if(FlxG.save.data.downBind == null){
FlxG.save.data.downBind = "S";
trace("No DOWN");
}
if(FlxG.save.data.leftBind == null){
FlxG.save.data.leftBind = "A";
trace("No LEFT");
}
if(FlxG.save.data.rightBind == null){
FlxG.save.data.rightBind = "D";
trace("No RIGHT");
}
if(FlxG.save.data.killBind == null){
FlxG.save.data.killBind = "R";
trace("No KILL");
}
}
}

View File

@ -0,0 +1,220 @@
package;
import Controls.KeyboardScheme;
import Controls.Control;
import flash.text.TextField;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.input.keyboard.FlxKey;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import lime.utils.Assets;
#if sys
import sys.io.File;
#end
class LoadReplayState extends MusicBeatState
{
var selector:FlxText;
var curSelected:Int = 0;
var songs:Array<FreeplayState.SongMetadata> = [];
var controlsStrings:Array<String> = [];
var actualNames:Array<String> = [];
private var grpControls:FlxTypedGroup<Alphabet>;
var versionShit:FlxText;
var poggerDetails:FlxText;
override function create()
{
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
#if sys
controlsStrings = sys.FileSystem.readDirectory(Sys.getCwd() + "/assets/replays/");
#end
trace(controlsStrings);
controlsStrings.sort(Reflect.compare);
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
for(i in 0...controlsStrings.length)
{
var string:String = controlsStrings[i];
actualNames[i] = string;
var rep:Replay = Replay.LoadReplay(string);
controlsStrings[i] = string.split("time")[0] + " " + CoolUtil.difficultyFromInt(rep.replay.songDiff).toUpperCase();
}
if (controlsStrings.length == 0)
controlsStrings.push("No Replays...");
menuBG.color = 0xFFea71fd;
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
menuBG.updateHitbox();
menuBG.screenCenter();
menuBG.antialiasing = true;
add(menuBG);
grpControls = new FlxTypedGroup<Alphabet>();
add(grpControls);
for (i in 0...controlsStrings.length)
{
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, controlsStrings[i], true, false);
controlLabel.isMenuItem = true;
controlLabel.targetY = i;
grpControls.add(controlLabel);
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
}
versionShit = new FlxText(5, FlxG.height - 34, 0, "Replay Loader (ESCAPE TO GO BACK)\nNOTICE!!!! Replays are in a beta stage, and they are probably not 100% correct. expect misses and other stuff that isn't there!\n", 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
poggerDetails = new FlxText(5, 34, 0, "Replay Details - \nnone", 12);
poggerDetails.scrollFactor.set();
poggerDetails.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(poggerDetails);
changeSelection(0);
super.create();
}
public function getWeekNumbFromSong(songName:String):Int
{
var week:Int = 0;
for (i in 0...songs.length)
{
var pog:FreeplayState.SongMetadata = songs[i];
if (pog.songName == songName)
week = pog.week;
}
return week;
}
public function addSong(songName:String, weekNum:Int, songCharacter:String)
{
songs.push(new FreeplayState.SongMetadata(songName, weekNum, songCharacter));
}
public function addWeek(songs:Array<String>, weekNum:Int, ?songCharacters:Array<String>)
{
if (songCharacters == null)
songCharacters = ['bf'];
var num:Int = 0;
for (song in songs)
{
addSong(song, weekNum, songCharacters[num]);
if (songCharacters.length != 1)
num++;
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (controls.BACK)
FlxG.switchState(new OptionsMenu());
if (controls.UP_P)
changeSelection(-1);
if (controls.DOWN_P)
changeSelection(1);
if (controls.ACCEPT && grpControls.members[curSelected].text != "No Replays...")
{
trace('loading ' + actualNames[curSelected]);
PlayState.rep = Replay.LoadReplay(actualNames[curSelected]);
PlayState.loadRep = true;
if (PlayState.rep.replay.replayGameVer == Replay.version)
{
// adjusting the song name to be compatible
var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';
case 'Philly-Nice': songFormat = 'Philly';
// Replay v1.0 support
case 'dad-battle': songFormat = 'Dadbattle';
case 'philly-nice': songFormat = 'Philly';
}
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName);
LoadingState.loadAndSwitchState(new PlayState());
}
else
{
PlayState.rep = null;
PlayState.loadRep = false;
}
}
}
var isSettingControl:Bool = false;
function changeSelection(change:Int = 0)
{
#if !switch
// NGio.logEvent('Fresh');
#end
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
curSelected += change;
if (curSelected < 0)
curSelected = grpControls.length - 1;
if (curSelected >= grpControls.length)
curSelected = 0;
var rep:Replay = Replay.LoadReplay(actualNames[curSelected]);
poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + rep.replay.replayGameVer + ' (' + (rep.replay.replayGameVer != Replay.version ? "OUTDATED not useable!" : "Latest") + ')\n';
// selector.y = (70 * curSelected) + 30;
var bullShit:Int = 0;
for (item in grpControls.members)
{
item.targetY = bullShit - curSelected;
bullShit++;
item.alpha = 0.6;
// item.setGraphicSize(Std.int(item.width * 0.8));
if (item.targetY == 0)
{
item.alpha = 1;
// item.setGraphicSize(Std.int(item.width));
}
}
}
}

View File

@ -0,0 +1,310 @@
package;
import lime.app.Promise;
import lime.app.Future;
import flixel.FlxG;
import flixel.FlxState;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.util.FlxTimer;
import openfl.utils.Assets;
import lime.utils.Assets as LimeAssets;
import lime.utils.AssetLibrary;
import lime.utils.AssetManifest;
import haxe.io.Path;
class LoadingState extends MusicBeatState
{
inline static var MIN_TIME = 1.0;
var target:FlxState;
var stopMusic = false;
var callbacks:MultiCallback;
var logo:FlxSprite;
var gfDance:FlxSprite;
var danceLeft = false;
function new(target:FlxState, stopMusic:Bool)
{
super();
this.target = target;
this.stopMusic = stopMusic;
}
override function create()
{
logo = new FlxSprite(-150, -100);
logo.frames = Paths.getSparrowAtlas('logoBumpin');
logo.antialiasing = true;
logo.animation.addByPrefix('bump', 'logo bumpin', 24);
logo.animation.play('bump');
logo.updateHitbox();
// logoBl.screenCenter();
// logoBl.color = FlxColor.BLACK;
gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07);
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
gfDance.antialiasing = true;
add(gfDance);
add(logo);
initSongsManifest().onComplete
(
function (lib)
{
callbacks = new MultiCallback(onLoad);
var introComplete = callbacks.add("introComplete");
checkLoadSong(getSongPath());
if (PlayState.SONG.needsVoices)
checkLoadSong(getVocalPath());
checkLibrary("shared");
if (PlayState.storyWeek > 0)
checkLibrary("week" + PlayState.storyWeek);
else
checkLibrary("tutorial");
var fadeTime = 0.5;
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
}
);
}
function checkLoadSong(path:String)
{
if (!Assets.cache.hasSound(path))
{
var library = Assets.getLibrary("songs");
final symbolPath = path.split(":").pop();
// @:privateAccess
// library.types.set(symbolPath, SOUND);
// @:privateAccess
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
var callback = callbacks.add("song:" + path);
Assets.loadSound(path).onComplete(function (_) { callback(); });
}
}
function checkLibrary(library:String)
{
trace(Assets.hasLibrary(library));
if (Assets.getLibrary(library) == null)
{
@:privateAccess
if (!LimeAssets.libraryPaths.exists(library))
throw "Missing library: " + library;
var callback = callbacks.add("library:" + library);
Assets.loadLibrary(library).onComplete(function (_) { callback(); });
}
}
override function beatHit()
{
super.beatHit();
logo.animation.play('bump');
danceLeft = !danceLeft;
if (danceLeft)
gfDance.animation.play('danceRight');
else
gfDance.animation.play('danceLeft');
}
override function update(elapsed:Float)
{
super.update(elapsed);
#if debug
if (FlxG.keys.justPressed.SPACE)
trace('fired: ' + callbacks.getFired() + " unfired:" + callbacks.getUnfired());
#end
}
function onLoad()
{
if (stopMusic && FlxG.sound.music != null)
FlxG.sound.music.stop();
FlxG.switchState(target);
}
static function getSongPath()
{
return Paths.inst(PlayState.SONG.song);
}
static function getVocalPath()
{
return Paths.voices(PlayState.SONG.song);
}
inline static public function loadAndSwitchState(target:FlxState, stopMusic = false)
{
FlxG.switchState(getNextState(target, stopMusic));
}
static function getNextState(target:FlxState, stopMusic = false):FlxState
{
Paths.setCurrentLevel("week" + PlayState.storyWeek);
#if NO_PRELOAD_ALL
var loaded = isSoundLoaded(getSongPath())
&& (!PlayState.SONG.needsVoices || isSoundLoaded(getVocalPath()))
&& isLibraryLoaded("shared");
if (!loaded)
return new LoadingState(target, stopMusic);
#end
if (stopMusic && FlxG.sound.music != null)
FlxG.sound.music.stop();
return target;
}
#if NO_PRELOAD_ALL
static function isSoundLoaded(path:String):Bool
{
return Assets.cache.hasSound(path);
}
static function isLibraryLoaded(library:String):Bool
{
return Assets.getLibrary(library) != null;
}
#end
override function destroy()
{
super.destroy();
callbacks = null;
}
static function initSongsManifest()
{
var id = "songs";
var promise = new Promise<AssetLibrary>();
var library = LimeAssets.getLibrary(id);
if (library != null)
{
return Future.withValue(library);
}
var path = id;
var rootPath = null;
@:privateAccess
var libraryPaths = LimeAssets.libraryPaths;
if (libraryPaths.exists(id))
{
path = libraryPaths[id];
rootPath = Path.directory(path);
}
else
{
if (StringTools.endsWith(path, ".bundle"))
{
rootPath = path;
path += "/library.json";
}
else
{
rootPath = Path.directory(path);
}
@:privateAccess
path = LimeAssets.__cacheBreak(path);
}
AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest)
{
if (manifest == null)
{
promise.error("Cannot parse asset manifest for library \"" + id + "\"");
return;
}
var library = AssetLibrary.fromManifest(manifest);
if (library == null)
{
promise.error("Cannot open library \"" + id + "\"");
}
else
{
@:privateAccess
LimeAssets.libraries.set(id, library);
library.onChange.add(LimeAssets.onChange.dispatch);
promise.completeWith(Future.withValue(library));
}
}).onError(function(_)
{
promise.error("There is no asset library with an ID of \"" + id + "\"");
});
return promise.future;
}
}
class MultiCallback
{
public var callback:Void->Void;
public var logId:String = null;
public var length(default, null) = 0;
public var numRemaining(default, null) = 0;
var unfired = new Map<String, Void->Void>();
var fired = new Array<String>();
public function new (callback:Void->Void, logId:String = null)
{
this.callback = callback;
this.logId = logId;
}
public function add(id = "untitled")
{
id = '$length:$id';
length++;
numRemaining++;
var func:Void->Void = null;
func = function ()
{
if (unfired.exists(id))
{
unfired.remove(id);
fired.push(id);
numRemaining--;
if (logId != null)
log('fired $id, $numRemaining remaining');
if (numRemaining == 0)
{
if (logId != null)
log('all callbacks fired');
callback();
}
}
else
log('already fired $id');
}
unfired[id] = func;
return func;
}
inline function log(msg):Void
{
if (logId != null)
trace('$logId: $msg');
}
public function getFired() return fired.copy();
public function getUnfired() return [for (id in unfired.keys()) id];
}

View File

@ -0,0 +1,72 @@
/*import flixel.system.FlxAssets.FlxShader;
class LuaShader extends FlxShader
{
// SHADER SHIT FOR LUA CODE
public function new(frag,vert)
{
glFragmentSource = '
#pragma header
varying float openfl_Alphav;
varying vec4 openfl_ColorMultiplierv;
varying vec4 openfl_ColorOffsetv;
varying vec2 openfl_TextureCoordv;
uniform bool openfl_HasColorTransform;
uniform vec2 openfl_TextureSize;
uniform sampler2D bitmap;
uniform bool hasTransform;
uniform bool hasColorTransform;
uniform vec3 iResolution; // viewport resolution (in pixels)
uniform float iTime; // shader playback time (in seconds)
uniform float iTimeDelta; // render time (in seconds)
uniform int iFrame; // shader playback frame
uniform float iChannelTime[4]; // channel playback time (in seconds)
uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4 iMouse; // mouse pixel coords. xy: current, zw: click
uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube
uniform vec4 iDate; // (year, month, day, time in seconds)
uniform float iSampleRate; // sound sample rate (i.e., 44100)
vec4 flixel_texture2D(sampler2D bitmap, vec2 coord)
{
vec4 color = texture2D(bitmap, coord);
if (!hasTransform)
{
return color;
}
if (color.a == 0.0)
{
return vec4(0.0, 0.0, 0.0, 0.0);
}
if (!hasColorTransform)
{
return color * openfl_Alphav;
}
color = vec4(color.rgb / color.a, color.a);
mat4 colorMultiplier = mat4(0);
colorMultiplier[0][0] = openfl_ColorMultiplierv.x;
colorMultiplier[1][1] = openfl_ColorMultiplierv.y;
colorMultiplier[2][2] = openfl_ColorMultiplierv.z;
colorMultiplier[3][3] = openfl_ColorMultiplierv.w;
color = clamp(openfl_ColorOffsetv + (color * colorMultiplier), 0.0, 1.0);
if (color.a > 0.0)
{
return vec4(0.0, 0.0, 0.0, 0.0);
}
' + frag;
iResolution
super();
}
}*/

121
source - Copy/Main.hx Normal file
View File

@ -0,0 +1,121 @@
package;
import webm.WebmPlayer;
import openfl.display.BlendMode;
import openfl.text.TextFormat;
import openfl.display.Application;
import flixel.util.FlxColor;
import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxState;
import openfl.Assets;
import openfl.Lib;
import openfl.display.FPS;
import openfl.display.Sprite;
import openfl.events.Event;
class Main extends Sprite
{
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
var initialState:Class<FlxState> = TitleState; // The FlxState the game starts with.
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
var framerate:Int = 120; // How many frames per second the game should run at.
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
public static var watermarks = true; // Whether to put Kade Engine liteartly anywhere
// You can pretty much ignore everything from here on - your code should go in your states.
public static function main():Void
{
// quick checks
Lib.current.addChild(new Main());
}
public function new()
{
super();
if (stage != null)
{
init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
public static var webmHandler:WebmHandler;
private function init(?E:Event):Void
{
if (hasEventListener(Event.ADDED_TO_STAGE))
{
removeEventListener(Event.ADDED_TO_STAGE, init);
}
setupGame();
}
private function setupGame():Void
{
var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight;
if (zoom == -1)
{
var ratioX:Float = stageWidth / gameWidth;
var ratioY:Float = stageHeight / gameHeight;
zoom = Math.min(ratioX, ratioY);
gameWidth = Math.ceil(stageWidth / zoom);
gameHeight = Math.ceil(stageHeight / zoom);
}
initialState = Caching;
game = new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen);
addChild(game);
#if !mobile
fpsCounter = new FPS(10, 3, 0xFFFFFF);
addChild(fpsCounter);
toggleFPS(FlxG.save.data.fps);
#end
}
var game:FlxGame;
var fpsCounter:FPS;
public function toggleFPS(fpsEnabled:Bool):Void {
fpsCounter.visible = fpsEnabled;
}
public function changeFPSColor(color:FlxColor)
{
fpsCounter.textColor = color;
}
public function setFPSCap(cap:Float)
{
openfl.Lib.current.stage.frameRate = cap;
}
public function getFPSCap():Float
{
return openfl.Lib.current.stage.frameRate;
}
public function getFPS():Float
{
return fpsCounter.currentFPS;
}
}

View File

@ -0,0 +1,263 @@
package;
import Controls.KeyboardScheme;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.effects.FlxFlicker;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import io.newgrounds.NG;
import lime.app.Application;
#if windows
import Discord.DiscordClient;
#end
using StringTools;
class MainMenuState extends MusicBeatState
{
var curSelected:Int = 0;
var menuItems:FlxTypedGroup<FlxSprite>;
#if !switch
var optionShit:Array<String> = ['story mode', 'freeplay', 'donate', 'options'];
#else
var optionShit:Array<String> = ['story mode', 'freeplay'];
#end
var newGaming:FlxText;
var newGaming2:FlxText;
public static var firstStart:Bool = true;
public static var nightly:String = "";
public static var kadeEngineVer:String = "1.5.3" + nightly;
public static var gameVer:String = "0.2.7.1";
var magenta:FlxSprite;
var camFollow:FlxObject;
public static var finishedFunnyMove:Bool = false;
override function create()
{
#if windows
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null);
#end
if (!FlxG.sound.music.playing)
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}
persistentUpdate = persistentDraw = true;
var bg:FlxSprite = new FlxSprite(-100).loadGraphic(Paths.image('menuBG'));
bg.scrollFactor.x = 0;
bg.scrollFactor.y = 0.10;
bg.setGraphicSize(Std.int(bg.width * 1.1));
bg.updateHitbox();
bg.screenCenter();
bg.antialiasing = true;
add(bg);
camFollow = new FlxObject(0, 0, 1, 1);
add(camFollow);
magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat'));
magenta.scrollFactor.x = 0;
magenta.scrollFactor.y = 0.10;
magenta.setGraphicSize(Std.int(magenta.width * 1.1));
magenta.updateHitbox();
magenta.screenCenter();
magenta.visible = false;
magenta.antialiasing = true;
magenta.color = 0xFFfd719b;
add(magenta);
// magenta.scrollFactor.set();
menuItems = new FlxTypedGroup<FlxSprite>();
add(menuItems);
var tex = Paths.getSparrowAtlas('FNF_main_menu_assets');
for (i in 0...optionShit.length)
{
var menuItem:FlxSprite = new FlxSprite(0, FlxG.height * 1.6);
menuItem.frames = tex;
menuItem.animation.addByPrefix('idle', optionShit[i] + " basic", 24);
menuItem.animation.addByPrefix('selected', optionShit[i] + " white", 24);
menuItem.animation.play('idle');
menuItem.ID = i;
menuItem.screenCenter(X);
menuItems.add(menuItem);
menuItem.scrollFactor.set();
menuItem.antialiasing = true;
if (firstStart)
FlxTween.tween(menuItem,{y: 60 + (i * 160)},1 + (i * 0.25) ,{ease: FlxEase.expoInOut, onComplete: function(flxTween:FlxTween)
{
finishedFunnyMove = true;
changeItem();
}});
else
menuItem.y = 60 + (i * 160);
}
firstStart = false;
FlxG.camera.follow(camFollow, null, 0.60 * (60 / FlxG.save.data.fpsCap));
var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, gameVer + (Main.watermarks ? " FNF - " + kadeEngineVer + " Kade Engine" : ""), 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
// NG.core.calls.event.logEvent('swag').send();
if (FlxG.save.data.dfjk)
controls.setKeyboardScheme(KeyboardScheme.Solo, true);
else
controls.setKeyboardScheme(KeyboardScheme.Duo(true), true);
changeItem();
super.create();
}
var selectedSomethin:Bool = false;
override function update(elapsed:Float)
{
if (FlxG.sound.music.volume < 0.8)
{
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
}
if (!selectedSomethin)
{
if (controls.UP_P)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(-1);
}
if (controls.DOWN_P)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(1);
}
if (controls.BACK)
{
FlxG.switchState(new TitleState());
}
if (controls.ACCEPT)
{
if (optionShit[curSelected] == 'donate')
{
fancyOpenURL("https://ninja-muffin24.itch.io/funkin");
}
else
{
selectedSomethin = true;
FlxG.sound.play(Paths.sound('confirmMenu'));
if (FlxG.save.data.flashing)
FlxFlicker.flicker(magenta, 1.1, 0.15, false);
menuItems.forEach(function(spr:FlxSprite)
{
if (curSelected != spr.ID)
{
FlxTween.tween(spr, {alpha: 0}, 1.3, {
ease: FlxEase.quadOut,
onComplete: function(twn:FlxTween)
{
spr.kill();
}
});
}
else
{
if (FlxG.save.data.flashing)
{
FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
{
goToState();
});
}
else
{
new FlxTimer().start(1, function(tmr:FlxTimer)
{
goToState();
});
}
}
});
}
}
}
super.update(elapsed);
menuItems.forEach(function(spr:FlxSprite)
{
spr.screenCenter(X);
});
}
function goToState()
{
var daChoice:String = optionShit[curSelected];
switch (daChoice)
{
case 'story mode':
FlxG.switchState(new StoryMenuState());
trace("Story Menu Selected");
case 'freeplay':
FlxG.switchState(new FreeplayState());
trace("Freeplay Menu Selected");
case 'options':
FlxG.switchState(new OptionsMenu());
}
}
function changeItem(huh:Int = 0)
{
if (finishedFunnyMove)
{
curSelected += huh;
if (curSelected >= menuItems.length)
curSelected = 0;
if (curSelected < 0)
curSelected = menuItems.length - 1;
}
menuItems.forEach(function(spr:FlxSprite)
{
spr.animation.play('idle');
if (spr.ID == curSelected && finishedFunnyMove)
{
spr.animation.play('selected');
camFollow.setPosition(spr.getGraphicMidpoint().x, spr.getGraphicMidpoint().y);
}
spr.updateHitbox();
});
}
}

View File

@ -0,0 +1,79 @@
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class CharacterSetting
{
public var x(default, null):Int;
public var y(default, null):Int;
public var scale(default, null):Float;
public var flipped(default, null):Bool;
public function new(x:Int = 0, y:Int = 0, scale:Float = 1.0, flipped:Bool = false)
{
this.x = x;
this.y = y;
this.scale = scale;
this.flipped = flipped;
}
}
class MenuCharacter extends FlxSprite
{
private static var settings:Map<String, CharacterSetting> = [
'bf' => new CharacterSetting(0, -20, 1.0, true),
'gf' => new CharacterSetting(50, 80, 1.5, true),
'dad' => new CharacterSetting(-15, 130),
'spooky' => new CharacterSetting(20, 30),
'pico' => new CharacterSetting(0, 0, 1.0, true),
'mom' => new CharacterSetting(-30, 140, 0.85),
'parents-christmas' => new CharacterSetting(100, 130, 1.8),
'senpai' => new CharacterSetting(-40, -45, 1.4)
];
private var flipped:Bool = false;
public function new(x:Int, y:Int, scale:Float, flipped:Bool)
{
super(x, y);
this.flipped = flipped;
antialiasing = true;
frames = Paths.getSparrowAtlas('campaign_menu_UI_characters');
animation.addByPrefix('bf', "BF idle dance white", 24);
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
animation.addByPrefix('pico', "Pico Idle Dance", 24);
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
setGraphicSize(Std.int(width * scale));
updateHitbox();
}
public function setCharacter(character:String):Void
{
if (character == '')
{
visible = false;
return;
}
else
{
visible = true;
}
animation.play(character);
var setting:CharacterSetting = settings[character];
offset.set(setting.x, setting.y);
setGraphicSize(Std.int(width * setting.scale));
flipX = setting.flipped != flipped;
}
}

49
source - Copy/MenuItem.hx Normal file
View File

@ -0,0 +1,49 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup;
import flixel.math.FlxMath;
import flixel.util.FlxColor;
class MenuItem extends FlxSpriteGroup
{
public var targetY:Float = 0;
public var week:FlxSprite;
public var flashingInt:Int = 0;
public function new(x:Float, y:Float, weekNum:Int = 0)
{
super(x, y);
week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum));
add(week);
}
private var isFlashing:Bool = false;
public function startFlashing():Void
{
isFlashing = true;
}
// if it runs at 60fps, fake framerate will be 6
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
// so it runs basically every so many seconds, not dependant on framerate??
// I'm still learning how math works thanks whoever is reading this lol
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
override function update(elapsed:Float)
{
super.update(elapsed);
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17 * (60 / FlxG.save.data.fpsCap));
if (isFlashing)
flashingInt += 1;
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
week.color = 0xFF33ffff;
else if (FlxG.save.data.flashing)
week.color = FlxColor.WHITE;
}
}

View File

@ -0,0 +1,918 @@
// this file is for modchart things, this is to declutter playstate.hx
// Lua
import openfl.display3D.textures.VideoTexture;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
#if windows
import flixel.tweens.FlxEase;
import openfl.filters.ShaderFilter;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import openfl.geom.Matrix;
import openfl.display.BitmapData;
import lime.app.Application;
import flixel.FlxSprite;
import llua.Convert;
import llua.Lua;
import llua.State;
import llua.LuaL;
import flixel.FlxBasic;
import flixel.FlxCamera;
import flixel.FlxG;
class ModchartState
{
//public static var shaders:Array<LuaShader> = null;
public static var lua:State = null;
function callLua(func_name : String, args : Array<Dynamic>, ?type : String) : Dynamic
{
var result : Any = null;
Lua.getglobal(lua, func_name);
for( arg in args ) {
Convert.toLua(lua, arg);
}
result = Lua.pcall(lua, args.length, 1, 0);
var p = Lua.tostring(lua,result);
var e = getLuaErrorMessage(lua);
if (e != null)
{
if (p != null)
{
Application.current.window.alert("LUA ERROR:\n" + p + "\nhaxe things: " + e,"Kade Engine Modcharts");
lua = null;
LoadingState.loadAndSwitchState(new MainMenuState());
}
// trace('err: ' + e);
}
if( result == null) {
return null;
} else {
return convert(result, type);
}
}
static function toLua(l:State, val:Any):Bool {
switch (Type.typeof(val)) {
case Type.ValueType.TNull:
Lua.pushnil(l);
case Type.ValueType.TBool:
Lua.pushboolean(l, val);
case Type.ValueType.TInt:
Lua.pushinteger(l, cast(val, Int));
case Type.ValueType.TFloat:
Lua.pushnumber(l, val);
case Type.ValueType.TClass(String):
Lua.pushstring(l, cast(val, String));
case Type.ValueType.TClass(Array):
Convert.arrayToLua(l, val);
case Type.ValueType.TObject:
objectToLua(l, val);
default:
trace("haxe value not supported - " + val + " which is a type of " + Type.typeof(val));
return false;
}
return true;
}
static function objectToLua(l:State, res:Any) {
var FUCK = 0;
for(n in Reflect.fields(res))
{
trace(Type.typeof(n).getName());
FUCK++;
}
Lua.createtable(l, FUCK, 0); // TODONE: I did it
for (n in Reflect.fields(res)){
if (!Reflect.isObject(n))
continue;
Lua.pushstring(l, n);
toLua(l, Reflect.field(res, n));
Lua.settable(l, -3);
}
}
function getType(l, type):Any
{
return switch Lua.type(l,type) {
case t if (t == Lua.LUA_TNIL): null;
case t if (t == Lua.LUA_TNUMBER): Lua.tonumber(l, type);
case t if (t == Lua.LUA_TSTRING): (Lua.tostring(l, type):String);
case t if (t == Lua.LUA_TBOOLEAN): Lua.toboolean(l, type);
case t: throw 'you don goofed up. lua type error ($t)';
}
}
function getReturnValues(l) {
var lua_v:Int;
var v:Any = null;
while((lua_v = Lua.gettop(l)) != 0) {
var type:String = getType(l,lua_v);
v = convert(lua_v, type);
Lua.pop(l, 1);
}
return v;
}
private function convert(v : Any, type : String) : Dynamic { // I didn't write this lol
if( Std.is(v, String) && type != null ) {
var v : String = v;
if( type.substr(0, 4) == 'array' ) {
if( type.substr(4) == 'float' ) {
var array : Array<String> = v.split(',');
var array2 : Array<Float> = new Array();
for( vars in array ) {
array2.push(Std.parseFloat(vars));
}
return array2;
} else if( type.substr(4) == 'int' ) {
var array : Array<String> = v.split(',');
var array2 : Array<Int> = new Array();
for( vars in array ) {
array2.push(Std.parseInt(vars));
}
return array2;
} else {
var array : Array<String> = v.split(',');
return array;
}
} else if( type == 'float' ) {
return Std.parseFloat(v);
} else if( type == 'int' ) {
return Std.parseInt(v);
} else if( type == 'bool' ) {
if( v == 'true' ) {
return true;
} else {
return false;
}
} else {
return v;
}
} else {
return v;
}
}
function getLuaErrorMessage(l) {
var v:String = Lua.tostring(l, -1);
Lua.pop(l, 1);
return v;
}
public function setVar(var_name : String, object : Dynamic){
// trace('setting variable ' + var_name + ' to ' + object);
Lua.pushnumber(lua,object);
Lua.setglobal(lua, var_name);
}
public function getVar(var_name : String, type : String) : Dynamic {
var result : Any = null;
// trace('getting variable ' + var_name + ' with a type of ' + type);
Lua.getglobal(lua, var_name);
result = Convert.fromLua(lua,-1);
Lua.pop(lua,1);
if( result == null ) {
return null;
} else {
var result = convert(result, type);
//trace(var_name + ' result: ' + result);
return result;
}
}
function getActorByName(id:String):Dynamic
{
// pre defined names
switch(id)
{
case 'boyfriend':
@:privateAccess
return PlayState.boyfriend;
case 'girlfriend':
@:privateAccess
return PlayState.gf;
case 'dad':
@:privateAccess
return PlayState.dad;
}
// lua objects or what ever
if (luaSprites.get(id) == null)
{
if (Std.parseInt(id) == null)
return Reflect.getProperty(PlayState.instance,id);
return PlayState.PlayState.strumLineNotes.members[Std.parseInt(id)];
}
return luaSprites.get(id);
}
function getPropertyByName(id:String)
{
return Reflect.field(PlayState.instance,id);
}
public static var luaSprites:Map<String,FlxSprite> = [];
function changeDadCharacter(id:String)
{ var olddadx = PlayState.dad.x;
var olddady = PlayState.dad.y;
PlayState.instance.removeObject(PlayState.dad);
PlayState.dad = new Character(olddadx, olddady, id);
PlayState.instance.addObject(PlayState.dad);
PlayState.instance.iconP2.animation.play(id);
}
function changeBoyfriendCharacter(id:String)
{ var oldboyfriendx = PlayState.boyfriend.x;
var oldboyfriendy = PlayState.boyfriend.y;
PlayState.instance.removeObject(PlayState.boyfriend);
PlayState.boyfriend = new Boyfriend(oldboyfriendx, oldboyfriendy, id);
PlayState.instance.addObject(PlayState.boyfriend);
PlayState.instance.iconP2.animation.play(id);
}
function makeAnimatedLuaSprite(spritePath:String,names:Array<String>,prefixes:Array<String>,startAnim:String, id:String)
{
#if sys
// pre lowercasing the song name (makeAnimatedLuaSprite)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + songLowercase + '/' + spritePath + ".png");
var sprite:FlxSprite = new FlxSprite(0,0);
sprite.frames = FlxAtlasFrames.fromSparrow(FlxGraphic.fromBitmapData(data), Sys.getCwd() + "assets/data/" + songLowercase + "/" + spritePath + ".xml");
trace(sprite.frames.frames.length);
for (p in 0...names.length)
{
var i = names[p];
var ii = prefixes[p];
sprite.animation.addByPrefix(i,ii,24,false);
}
luaSprites.set(id,sprite);
PlayState.instance.addObject(sprite);
sprite.animation.play(startAnim);
return id;
#end
}
function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool)
{
#if sys
// pre lowercasing the song name (makeLuaSprite)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + songLowercase + '/' + spritePath + ".png");
var sprite:FlxSprite = new FlxSprite(0,0);
var imgWidth:Float = FlxG.width / data.width;
var imgHeight:Float = FlxG.height / data.height;
var scale:Float = imgWidth <= imgHeight ? imgWidth : imgHeight;
// Cap the scale at x1
if (scale > 1)
scale = 1;
sprite.makeGraphic(Std.int(data.width * scale),Std.int(data.width * scale),FlxColor.TRANSPARENT);
var data2:BitmapData = sprite.pixels.clone();
var matrix:Matrix = new Matrix();
matrix.identity();
matrix.scale(scale, scale);
data2.fillRect(data2.rect, FlxColor.TRANSPARENT);
data2.draw(data, matrix, null, null, null, true);
sprite.pixels = data2;
luaSprites.set(toBeCalled,sprite);
// and I quote:
// shitty layering but it works!
@:privateAccess
{
if (drawBehind)
{
PlayState.instance.removeObject(PlayState.gf);
PlayState.instance.removeObject(PlayState.boyfriend);
PlayState.instance.removeObject(PlayState.dad);
}
PlayState.instance.addObject(sprite);
if (drawBehind)
{
PlayState.instance.addObject(PlayState.gf);
PlayState.instance.addObject(PlayState.boyfriend);
PlayState.instance.addObject(PlayState.dad);
}
}
#end
return toBeCalled;
}
public function die()
{
Lua.close(lua);
lua = null;
}
// LUA SHIT
function new()
{
trace('opening a lua state (because we are cool :))');
lua = LuaL.newstate();
LuaL.openlibs(lua);
trace("Lua version: " + Lua.version());
trace("LuaJIT version: " + Lua.versionJIT());
Lua.init_callbacks(lua);
//shaders = new Array<LuaShader>();
// pre lowercasing the song name (new)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
var result = LuaL.dofile(lua, Paths.lua(songLowercase + "/modchart")); // execute le file
if (result != 0)
{
Application.current.window.alert("LUA COMPILE ERROR:\n" + Lua.tostring(lua,result),"Kade Engine Modcharts");
lua = null;
LoadingState.loadAndSwitchState(new MainMenuState());
}
// get some fukin globals up in here bois
setVar("difficulty", PlayState.storyDifficulty);
setVar("bpm", Conductor.bpm);
setVar("scrollspeed", FlxG.save.data.scrollSpeed != 1 ? FlxG.save.data.scrollSpeed : PlayState.SONG.speed);
setVar("fpsCap", FlxG.save.data.fpsCap);
setVar("downscroll", FlxG.save.data.downscroll);
setVar("flashing", FlxG.save.data.flashing);
setVar("distractions", FlxG.save.data.distractions);
setVar("curStep", 0);
setVar("curBeat", 0);
setVar("crochet", Conductor.stepCrochet);
setVar("safeZoneOffset", Conductor.safeZoneOffset);
setVar("hudZoom", PlayState.instance.camHUD.zoom);
setVar("cameraZoom", FlxG.camera.zoom);
setVar("cameraAngle", FlxG.camera.angle);
setVar("camHudAngle", PlayState.instance.camHUD.angle);
setVar("followXOffset",0);
setVar("followYOffset",0);
setVar("showOnlyStrums", false);
setVar("strumLine1Visible", true);
setVar("strumLine2Visible", true);
setVar("screenWidth",FlxG.width);
setVar("screenHeight",FlxG.height);
setVar("windowWidth",FlxG.width);
setVar("windowHeight",FlxG.height);
setVar("hudWidth", PlayState.instance.camHUD.width);
setVar("hudHeight", PlayState.instance.camHUD.height);
setVar("mustHit", false);
setVar("strumLineY", PlayState.instance.strumLine.y);
// callbacks
// sprites
Lua_helper.add_callback(lua,"makeSprite", makeLuaSprite);
Lua_helper.add_callback(lua,"changeDadCharacter", changeDadCharacter);
Lua_helper.add_callback(lua,"changeBoyfriendCharacter", changeBoyfriendCharacter);
Lua_helper.add_callback(lua,"getProperty", getPropertyByName);
// Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite);
// this one is still in development
Lua_helper.add_callback(lua,"destroySprite", function(id:String) {
var sprite = luaSprites.get(id);
if (sprite == null)
return false;
PlayState.instance.removeObject(sprite);
return true;
});
// hud/camera
Lua_helper.add_callback(lua,"initBackgroundVideo", function(videoName:String) {
trace('playing assets/videos/' + videoName + '.webm');
PlayState.instance.backgroundVideo("assets/videos/" + videoName + ".webm");
});
Lua_helper.add_callback(lua,"pauseVideo", function() {
if (!GlobalVideo.get().paused)
GlobalVideo.get().pause();
});
Lua_helper.add_callback(lua,"resumeVideo", function() {
if (GlobalVideo.get().paused)
GlobalVideo.get().pause();
});
Lua_helper.add_callback(lua,"restartVideo", function() {
GlobalVideo.get().restart();
});
Lua_helper.add_callback(lua,"getVideoSpriteX", function() {
return PlayState.instance.videoSprite.x;
});
Lua_helper.add_callback(lua,"getVideoSpriteY", function() {
return PlayState.instance.videoSprite.y;
});
Lua_helper.add_callback(lua,"setVideoSpritePos", function(x:Int,y:Int) {
PlayState.instance.videoSprite.setPosition(x,y);
});
Lua_helper.add_callback(lua,"setVideoSpriteScale", function(scale:Float) {
PlayState.instance.videoSprite.setGraphicSize(Std.int(PlayState.instance.videoSprite.width * scale));
});
Lua_helper.add_callback(lua,"setHudAngle", function (x:Float) {
PlayState.instance.camHUD.angle = x;
});
Lua_helper.add_callback(lua,"setHealth", function (heal:Float) {
PlayState.instance.health = heal;
});
Lua_helper.add_callback(lua,"setHudPosition", function (x:Int, y:Int) {
PlayState.instance.camHUD.x = x;
PlayState.instance.camHUD.y = y;
});
Lua_helper.add_callback(lua,"getHudX", function () {
return PlayState.instance.camHUD.x;
});
Lua_helper.add_callback(lua,"getHudY", function () {
return PlayState.instance.camHUD.y;
});
Lua_helper.add_callback(lua,"setCamPosition", function (x:Int, y:Int) {
FlxG.camera.x = x;
FlxG.camera.y = y;
});
Lua_helper.add_callback(lua,"getCameraX", function () {
return FlxG.camera.x;
});
Lua_helper.add_callback(lua,"getCameraY", function () {
return FlxG.camera.y;
});
Lua_helper.add_callback(lua,"setCamZoom", function(zoomAmount:Float) {
FlxG.camera.zoom = zoomAmount;
});
Lua_helper.add_callback(lua,"setHudZoom", function(zoomAmount:Float) {
PlayState.instance.camHUD.zoom = zoomAmount;
});
// strumline
Lua_helper.add_callback(lua, "setStrumlineY", function(y:Float)
{
PlayState.instance.strumLine.y = y;
});
// actors
Lua_helper.add_callback(lua,"getRenderedNotes", function() {
return PlayState.instance.notes.length;
});
Lua_helper.add_callback(lua,"getRenderedNoteX", function(id:Int) {
return PlayState.instance.notes.members[id].x;
});
Lua_helper.add_callback(lua,"getRenderedNoteY", function(id:Int) {
return PlayState.instance.notes.members[id].y;
});
Lua_helper.add_callback(lua,"getRenderedNoteType", function(id:Int) {
return PlayState.instance.notes.members[id].noteData;
});
Lua_helper.add_callback(lua,"isSustain", function(id:Int) {
return PlayState.instance.notes.members[id].isSustainNote;
});
Lua_helper.add_callback(lua,"isParentSustain", function(id:Int) {
return PlayState.instance.notes.members[id].prevNote.isSustainNote;
});
Lua_helper.add_callback(lua,"getRenderedNoteParentX", function(id:Int) {
return PlayState.instance.notes.members[id].prevNote.x;
});
Lua_helper.add_callback(lua,"getRenderedNoteParentY", function(id:Int) {
return PlayState.instance.notes.members[id].prevNote.y;
});
Lua_helper.add_callback(lua,"getRenderedNoteHit", function(id:Int) {
return PlayState.instance.notes.members[id].mustPress;
});
Lua_helper.add_callback(lua,"getRenderedNoteCalcX", function(id:Int) {
if (PlayState.instance.notes.members[id].mustPress)
return PlayState.playerStrums.members[Math.floor(Math.abs(PlayState.instance.notes.members[id].noteData))].x;
return PlayState.strumLineNotes.members[Math.floor(Math.abs(PlayState.instance.notes.members[id].noteData))].x;
});
Lua_helper.add_callback(lua,"anyNotes", function() {
return PlayState.instance.notes.members.length != 0;
});
Lua_helper.add_callback(lua,"getRenderedNoteStrumtime", function(id:Int) {
return PlayState.instance.notes.members[id].strumTime;
});
Lua_helper.add_callback(lua,"getRenderedNoteScaleX", function(id:Int) {
return PlayState.instance.notes.members[id].scale.x;
});
Lua_helper.add_callback(lua,"setRenderedNotePos", function(x:Float,y:Float, id:Int) {
if (PlayState.instance.notes.members[id] == null)
throw('error! you cannot set a rendered notes position when it doesnt exist! ID: ' + id);
else
{
PlayState.instance.notes.members[id].modifiedByLua = true;
PlayState.instance.notes.members[id].x = x;
PlayState.instance.notes.members[id].y = y;
}
});
Lua_helper.add_callback(lua,"setRenderedNoteAlpha", function(alpha:Float, id:Int) {
PlayState.instance.notes.members[id].modifiedByLua = true;
PlayState.instance.notes.members[id].alpha = alpha;
});
Lua_helper.add_callback(lua,"setRenderedNoteScale", function(scale:Float, id:Int) {
PlayState.instance.notes.members[id].modifiedByLua = true;
PlayState.instance.notes.members[id].setGraphicSize(Std.int(PlayState.instance.notes.members[id].width * scale));
});
Lua_helper.add_callback(lua,"setRenderedNoteScale", function(scaleX:Int, scaleY:Int, id:Int) {
PlayState.instance.notes.members[id].modifiedByLua = true;
PlayState.instance.notes.members[id].setGraphicSize(scaleX,scaleY);
});
Lua_helper.add_callback(lua,"getRenderedNoteWidth", function(id:Int) {
return PlayState.instance.notes.members[id].width;
});
Lua_helper.add_callback(lua,"setRenderedNoteAngle", function(angle:Float, id:Int) {
PlayState.instance.notes.members[id].modifiedByLua = true;
PlayState.instance.notes.members[id].angle = angle;
});
Lua_helper.add_callback(lua,"setActorX", function(x:Int,id:String) {
getActorByName(id).x = x;
});
Lua_helper.add_callback(lua,"setActorAccelerationX", function(x:Int,id:String) {
getActorByName(id).acceleration.x = x;
});
Lua_helper.add_callback(lua,"setActorDragX", function(x:Int,id:String) {
getActorByName(id).drag.x = x;
});
Lua_helper.add_callback(lua,"setActorVelocityX", function(x:Int,id:String) {
getActorByName(id).velocity.x = x;
});
Lua_helper.add_callback(lua,"playActorAnimation", function(id:String,anim:String,force:Bool = false,reverse:Bool = false) {
getActorByName(id).playAnim(anim, force, reverse);
});
Lua_helper.add_callback(lua,"setActorAlpha", function(alpha:Float,id:String) {
getActorByName(id).alpha = alpha;
});
Lua_helper.add_callback(lua,"setActorY", function(y:Int,id:String) {
getActorByName(id).y = y;
});
Lua_helper.add_callback(lua,"setActorAccelerationY", function(y:Int,id:String) {
getActorByName(id).acceleration.y = y;
});
Lua_helper.add_callback(lua,"setActorDragY", function(y:Int,id:String) {
getActorByName(id).drag.y = y;
});
Lua_helper.add_callback(lua,"setActorVelocityY", function(y:Int,id:String) {
getActorByName(id).velocity.y = y;
});
Lua_helper.add_callback(lua,"setActorAngle", function(angle:Int,id:String) {
getActorByName(id).angle = angle;
});
Lua_helper.add_callback(lua,"setActorScale", function(scale:Float,id:String) {
getActorByName(id).setGraphicSize(Std.int(getActorByName(id).width * scale));
});
Lua_helper.add_callback(lua, "setActorScaleXY", function(scaleX:Float, scaleY:Float, id:String)
{
getActorByName(id).setGraphicSize(Std.int(getActorByName(id).width * scaleX), Std.int(getActorByName(id).height * scaleY));
});
Lua_helper.add_callback(lua, "setActorFlipX", function(flip:Bool, id:String)
{
getActorByName(id).flipX = flip;
});
Lua_helper.add_callback(lua, "setActorFlipY", function(flip:Bool, id:String)
{
getActorByName(id).flipY = flip;
});
Lua_helper.add_callback(lua,"getActorWidth", function (id:String) {
return getActorByName(id).width;
});
Lua_helper.add_callback(lua,"getActorHeight", function (id:String) {
return getActorByName(id).height;
});
Lua_helper.add_callback(lua,"getActorAlpha", function(id:String) {
return getActorByName(id).alpha;
});
Lua_helper.add_callback(lua,"getActorAngle", function(id:String) {
return getActorByName(id).angle;
});
Lua_helper.add_callback(lua,"getActorX", function (id:String) {
return getActorByName(id).x;
});
Lua_helper.add_callback(lua,"getActorY", function (id:String) {
return getActorByName(id).y;
});
Lua_helper.add_callback(lua,"setWindowPos",function(x:Int,y:Int) {
Application.current.window.x = x;
Application.current.window.y = y;
});
Lua_helper.add_callback(lua,"getWindowX",function() {
return Application.current.window.x;
});
Lua_helper.add_callback(lua,"getWindowY",function() {
return Application.current.window.y;
});
Lua_helper.add_callback(lua,"resizeWindow",function(Width:Int,Height:Int) {
Application.current.window.resize(Width,Height);
});
Lua_helper.add_callback(lua,"getScreenWidth",function() {
return Application.current.window.display.currentMode.width;
});
Lua_helper.add_callback(lua,"getScreenHeight",function() {
return Application.current.window.display.currentMode.height;
});
Lua_helper.add_callback(lua,"getWindowWidth",function() {
return Application.current.window.width;
});
Lua_helper.add_callback(lua,"getWindowHeight",function() {
return Application.current.window.height;
});
// tweens
Lua_helper.add_callback(lua,"tweenCameraPos", function(toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {x: toX, y: toY}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraAngle", function(toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {angle:toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraZoom", function(toZoom:Float, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {zoom:toZoom}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudPos", function(toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {x: toX, y: toY}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudAngle", function(toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {angle:toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudZoom", function(toZoom:Float, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {zoom:toZoom}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenPos", function(id:String, toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {x: toX, y: toY}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenPosXAngle", function(id:String, toX:Int, toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {x: toX, angle: toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenPosYAngle", function(id:String, toY:Int, toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {y: toY, angle: toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenAngle", function(id:String, toAngle:Int, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {angle: toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraPosOut", function(toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {x: toX, y: toY}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraAngleOut", function(toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {angle:toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraZoomOut", function(toZoom:Float, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {zoom:toZoom}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudPosOut", function(toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {x: toX, y: toY}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudAngleOut", function(toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {angle:toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudZoomOut", function(toZoom:Float, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {zoom:toZoom}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenPosOut", function(id:String, toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {x: toX, y: toY}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenPosXAngleOut", function(id:String, toX:Int, toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {x: toX, angle: toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenPosYAngleOut", function(id:String, toY:Int, toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {y: toY, angle: toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenAngleOut", function(id:String, toAngle:Int, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {angle: toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraPosIn", function(toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {x: toX, y: toY}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraAngleIn", function(toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {angle:toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenCameraZoomIn", function(toZoom:Float, time:Float, onComplete:String) {
FlxTween.tween(FlxG.camera, {zoom:toZoom}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudPosIn", function(toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {x: toX, y: toY}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudAngleIn", function(toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {angle:toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenHudZoomIn", function(toZoom:Float, time:Float, onComplete:String) {
FlxTween.tween(PlayState.instance.camHUD, {zoom:toZoom}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}});
});
Lua_helper.add_callback(lua,"tweenPosIn", function(id:String, toX:Int, toY:Int, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {x: toX, y: toY}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenPosXAngleIn", function(id:String, toX:Int, toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {x: toX, angle: toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenPosYAngleIn", function(id:String, toY:Int, toAngle:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {y: toY, angle: toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenAngleIn", function(id:String, toAngle:Int, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {angle: toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenFadeIn", function(id:String, toAlpha:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {alpha: toAlpha}, time, {ease: FlxEase.circIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
Lua_helper.add_callback(lua,"tweenFadeOut", function(id:String, toAlpha:Float, time:Float, onComplete:String) {
FlxTween.tween(getActorByName(id), {alpha: toAlpha}, time, {ease: FlxEase.circOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}});
});
//forgot and accidentally commit to master branch
// shader
/*Lua_helper.add_callback(lua,"createShader", function(frag:String,vert:String) {
var shader:LuaShader = new LuaShader(frag,vert);
trace(shader.glFragmentSource);
shaders.push(shader);
// if theres 1 shader we want to say theres 0 since 0 index and length returns a 1 index.
return shaders.length == 1 ? 0 : shaders.length;
});
Lua_helper.add_callback(lua,"setFilterHud", function(shaderIndex:Int) {
PlayState.instance.camHUD.setFilters([new ShaderFilter(shaders[shaderIndex])]);
});
Lua_helper.add_callback(lua,"setFilterCam", function(shaderIndex:Int) {
FlxG.camera.setFilters([new ShaderFilter(shaders[shaderIndex])]);
});*/
// default strums
for (i in 0...PlayState.strumLineNotes.length) {
var member = PlayState.strumLineNotes.members[i];
trace(PlayState.strumLineNotes.members[i].x + " " + PlayState.strumLineNotes.members[i].y + " " + PlayState.strumLineNotes.members[i].angle + " | strum" + i);
//setVar("strum" + i + "X", Math.floor(member.x));
setVar("defaultStrum" + i + "X", Math.floor(member.x));
//setVar("strum" + i + "Y", Math.floor(member.y));
setVar("defaultStrum" + i + "Y", Math.floor(member.y));
//setVar("strum" + i + "Angle", Math.floor(member.angle));
setVar("defaultStrum" + i + "Angle", Math.floor(member.angle));
trace("Adding strum" + i);
}
}
public function executeState(name,args:Array<Dynamic>)
{
return Lua.tostring(lua,callLua(name, args));
}
public static function createModchartState():ModchartState
{
return new ModchartState();
}
}
#end

View File

@ -0,0 +1,123 @@
package;
#if windows
import Discord.DiscordClient;
#end
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import openfl.Lib;
import Conductor.BPMChangeEvent;
import flixel.FlxG;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.ui.FlxUIState;
import flixel.math.FlxRect;
import flixel.util.FlxTimer;
class MusicBeatState extends FlxUIState
{
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var curStep:Int = 0;
private var curBeat:Int = 0;
private var controls(get, never):Controls;
inline function get_controls():Controls
return PlayerSettings.player1.controls;
override function create()
{
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
if (transIn != null)
trace('reg ' + transIn.region);
super.create();
}
var array:Array<FlxColor> = [
FlxColor.fromRGB(148, 0, 211),
FlxColor.fromRGB(75, 0, 130),
FlxColor.fromRGB(0, 0, 255),
FlxColor.fromRGB(0, 255, 0),
FlxColor.fromRGB(255, 255, 0),
FlxColor.fromRGB(255, 127, 0),
FlxColor.fromRGB(255, 0 , 0)
];
var skippedFrames = 0;
override function update(elapsed:Float)
{
//everyStep();
var oldStep:Int = curStep;
updateCurStep();
updateBeat();
if (oldStep != curStep && curStep > 0)
stepHit();
if (FlxG.save.data.fpsRain && skippedFrames >= 6)
{
if (currentColor >= array.length)
currentColor = 0;
(cast (Lib.current.getChildAt(0), Main)).changeFPSColor(array[currentColor]);
currentColor++;
skippedFrames = 0;
}
else
skippedFrames++;
if ((cast (Lib.current.getChildAt(0), Main)).getFPSCap != FlxG.save.data.fpsCap && FlxG.save.data.fpsCap <= 290)
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
super.update(elapsed);
}
private function updateBeat():Void
{
lastBeat = curStep;
curBeat = Math.floor(curStep / 4);
}
public static var currentColor = 0;
private function updateCurStep():Void
{
var lastChange:BPMChangeEvent = {
stepTime: 0,
songTime: 0,
bpm: 0
}
for (i in 0...Conductor.bpmChangeMap.length)
{
if (Conductor.songPosition >= Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
}
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
}
public function stepHit():Void
{
if (curStep % 4 == 0)
beatHit();
}
public function beatHit():Void
{
//do literally nothing dumbass
}
public function fancyOpenURL(schmancy:String)
{
#if linux
Sys.command('/usr/bin/xdg-open', [schmancy, "&"]);
#else
FlxG.openURL(schmancy);
#end
}
}

View File

@ -0,0 +1,65 @@
package;
import Conductor.BPMChangeEvent;
import flixel.FlxG;
import flixel.FlxSubState;
class MusicBeatSubstate extends FlxSubState
{
public function new()
{
super();
}
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var curStep:Int = 0;
private var curBeat:Int = 0;
private var controls(get, never):Controls;
inline function get_controls():Controls
return PlayerSettings.player1.controls;
override function update(elapsed:Float)
{
//everyStep();
var oldStep:Int = curStep;
updateCurStep();
curBeat = Math.floor(curStep / 4);
if (oldStep != curStep && curStep > 0)
stepHit();
super.update(elapsed);
}
private function updateCurStep():Void
{
var lastChange:BPMChangeEvent = {
stepTime: 0,
songTime: 0,
bpm: 0
}
for (i in 0...Conductor.bpmChangeMap.length)
{
if (Conductor.songPosition > Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
}
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
}
public function stepHit():Void
{
if (curStep % 4 == 0)
beatHit();
}
public function beatHit():Void
{
//do literally nothing dumbass
}
}

200
source - Copy/NGio.hx Normal file
View File

@ -0,0 +1,200 @@
package;
import flixel.FlxG;
import flixel.util.FlxSignal;
import flixel.util.FlxTimer;
import io.newgrounds.NG;
import io.newgrounds.components.ScoreBoardComponent.Period;
import io.newgrounds.objects.Medal;
import io.newgrounds.objects.Score;
import io.newgrounds.objects.ScoreBoard;
import io.newgrounds.objects.events.Response;
import io.newgrounds.objects.events.Result.GetCurrentVersionResult;
import io.newgrounds.objects.events.Result.GetVersionResult;
import lime.app.Application;
import openfl.display.Stage;
using StringTools;
/**
* MADE BY GEOKURELI THE LEGENED GOD HERO MVP
*/
class NGio
{
public static var isLoggedIn:Bool = false;
public static var scoreboardsLoaded:Bool = false;
public static var scoreboardArray:Array<Score> = [];
public static var ngDataLoaded(default, null):FlxSignal = new FlxSignal();
public static var ngScoresLoaded(default, null):FlxSignal = new FlxSignal();
public static var GAME_VER:String = "";
public static var GAME_VER_NUMS:String = '';
public static var gotOnlineVer:Bool = false;
public static function noLogin(api:String)
{
trace('INIT NOLOGIN');
GAME_VER = "v" + Application.current.meta.get('version');
if (api.length != 0)
{
NG.create(api);
new FlxTimer().start(2, function(tmr:FlxTimer)
{
var call = NG.core.calls.app.getCurrentVersion(GAME_VER).addDataHandler(function(response:Response<GetCurrentVersionResult>)
{
GAME_VER = response.result.data.currentVersion;
GAME_VER_NUMS = GAME_VER.split(" ")[0].trim();
trace('CURRENT NG VERSION: ' + GAME_VER);
trace('CURRENT NG VERSION: ' + GAME_VER_NUMS);
gotOnlineVer = true;
});
call.send();
});
}
}
public function new(api:String, encKey:String, ?sessionId:String)
{
trace("connecting to newgrounds");
NG.createAndCheckSession(api, sessionId);
NG.core.verbose = true;
// Set the encryption cipher/format to RC4/Base64. AES128 and Hex are not implemented yet
NG.core.initEncryption(encKey); // Found in you NG project view
trace(NG.core.attemptingLogin);
if (NG.core.attemptingLogin)
{
/* a session_id was found in the loadervars, this means the user is playing on newgrounds.com
* and we should login shortly. lets wait for that to happen
*/
trace("attempting login");
NG.core.onLogin.add(onNGLogin);
}
else
{
/* They are NOT playing on newgrounds.com, no session id was found. We must start one manually, if we want to.
* Note: This will cause a new browser window to pop up where they can log in to newgrounds
*/
NG.core.requestLogin(onNGLogin);
}
}
function onNGLogin():Void
{
trace('logged in! user:${NG.core.user.name}');
isLoggedIn = true;
FlxG.save.data.sessionId = NG.core.sessionId;
// FlxG.save.flush();
// Load medals then call onNGMedalFetch()
NG.core.requestMedals(onNGMedalFetch);
// Load Scoreboards hten call onNGBoardsFetch()
NG.core.requestScoreBoards(onNGBoardsFetch);
ngDataLoaded.dispatch();
}
// --- MEDALS
function onNGMedalFetch():Void
{
/*
// Reading medal info
for (id in NG.core.medals.keys())
{
var medal = NG.core.medals.get(id);
trace('loaded medal id:$id, name:${medal.name}, description:${medal.description}');
}
// Unlocking medals
var unlockingMedal = NG.core.medals.get(54352);// medal ids are listed in your NG project viewer
if (!unlockingMedal.unlocked)
unlockingMedal.sendUnlock();
*/
}
// --- SCOREBOARDS
function onNGBoardsFetch():Void
{
/*
// Reading medal info
for (id in NG.core.scoreBoards.keys())
{
var board = NG.core.scoreBoards.get(id);
trace('loaded scoreboard id:$id, name:${board.name}');
}
*/
// var board = NG.core.scoreBoards.get(8004);// ID found in NG project view
// Posting a score thats OVER 9000!
// board.postScore(FlxG.random.int(0, 1000));
// --- To view the scores you first need to select the range of scores you want to see ---
// add an update listener so we know when we get the new scores
// board.onUpdate.add(onNGScoresFetch);
trace("shoulda got score by NOW!");
// board.requestScores(20);// get the best 10 scores ever logged
// more info on scores --- http://www.newgrounds.io/help/components/#scoreboard-getscores
}
inline static public function postScore(score:Int = 0, song:String)
{
if (isLoggedIn)
{
for (id in NG.core.scoreBoards.keys())
{
var board = NG.core.scoreBoards.get(id);
if (song == board.name)
{
board.postScore(score, "Uhh meow?");
}
// trace('loaded scoreboard id:$id, name:${board.name}');
}
}
}
function onNGScoresFetch():Void
{
scoreboardsLoaded = true;
ngScoresLoaded.dispatch();
/*
for (score in NG.core.scoreBoards.get(8737).scores)
{
trace('score loaded user:${score.user.name}, score:${score.formatted_value}');
}
*/
// var board = NG.core.scoreBoards.get(8004);// ID found in NG project view
// board.postScore(HighScore.score);
// NGio.scoreboardArray = NG.core.scoreBoards.get(8004).scores;
}
inline static public function logEvent(event:String)
{
NG.core.calls.event.logEvent(event).send();
trace('should have logged: ' + event);
}
inline static public function unlockMedal(id:Int)
{
if (isLoggedIn)
{
var medal = NG.core.medals.get(id);
if (!medal.unlocked)
medal.sendUnlock();
}
}
}

238
source - Copy/Note.hx Normal file
View File

@ -0,0 +1,238 @@
package;
import flixel.addons.effects.FlxSkewedSprite;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxMath;
import flixel.util.FlxColor;
#if polymod
import polymod.format.ParseRules.TargetSignatureElement;
#end
import PlayState;
using StringTools;
class Note extends FlxSprite
{
public var strumTime:Float = 0;
public var mustPress:Bool = false;
public var noteData:Int = 0;
public var canBeHit:Bool = false;
public var tooLate:Bool = false;
public var wasGoodHit:Bool = false;
public var prevNote:Note;
public var modifiedByLua:Bool = false;
public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var noteScore:Float = 1;
public static var swagWidth:Float = 160 * 0.7;
public static var PURP_NOTE:Int = 0;
public static var GREEN_NOTE:Int = 2;
public static var BLUE_NOTE:Int = 1;
public static var RED_NOTE:Int = 3;
public var rating:String = "shit";
public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false)
{
super();
if (prevNote == null)
prevNote = this;
this.prevNote = prevNote;
isSustainNote = sustainNote;
x += 50;
// MAKE SURE ITS DEFINITELY OFF SCREEN?
y -= 2000;
if (inCharter)
this.strumTime = strumTime;
else
this.strumTime = Math.round(strumTime);
if (this.strumTime < 0 )
this.strumTime = 0;
this.noteData = noteData;
var daStage:String = PlayState.curStage;
//defaults if no noteStyle was found in chart
var noteTypeCheck:String = 'normal';
if (PlayState.SONG.noteStyle == null) {
switch(PlayState.storyWeek) {case 6: noteTypeCheck = 'pixel';}
} else {noteTypeCheck = PlayState.SONG.noteStyle;}
switch (noteTypeCheck)
{
case 'pixel':
loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels','week6'), true, 17, 17);
animation.add('greenScroll', [6]);
animation.add('redScroll', [7]);
animation.add('blueScroll', [5]);
animation.add('purpleScroll', [4]);
if (isSustainNote)
{
loadGraphic(Paths.image('weeb/pixelUI/arrowEnds','week6'), true, 7, 6);
animation.add('purpleholdend', [4]);
animation.add('greenholdend', [6]);
animation.add('redholdend', [7]);
animation.add('blueholdend', [5]);
animation.add('purplehold', [0]);
animation.add('greenhold', [2]);
animation.add('redhold', [3]);
animation.add('bluehold', [1]);
}
setGraphicSize(Std.int(width * PlayState.daPixelZoom));
updateHitbox();
default:
frames = Paths.getSparrowAtlas('NOTE_assets');
animation.addByPrefix('greenScroll', 'green0');
animation.addByPrefix('redScroll', 'red0');
animation.addByPrefix('blueScroll', 'blue0');
animation.addByPrefix('purpleScroll', 'purple0');
animation.addByPrefix('purpleholdend', 'pruple end hold');
animation.addByPrefix('greenholdend', 'green hold end');
animation.addByPrefix('redholdend', 'red hold end');
animation.addByPrefix('blueholdend', 'blue hold end');
animation.addByPrefix('purplehold', 'purple hold piece');
animation.addByPrefix('greenhold', 'green hold piece');
animation.addByPrefix('redhold', 'red hold piece');
animation.addByPrefix('bluehold', 'blue hold piece');
setGraphicSize(Std.int(width * 0.7));
updateHitbox();
antialiasing = true;
}
switch (noteData)
{
case 0:
x += swagWidth * 0;
animation.play('purpleScroll');
case 1:
x += swagWidth * 1;
animation.play('blueScroll');
case 2:
x += swagWidth * 2;
animation.play('greenScroll');
case 3:
x += swagWidth * 3;
animation.play('redScroll');
}
// trace(prevNote);
// we make sure its downscroll and its a SUSTAIN NOTE (aka a trail, not a note)
// and flip it so it doesn't look weird.
// THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS
if (FlxG.save.data.downscroll && sustainNote)
flipY = true;
if (isSustainNote && prevNote != null)
{
noteScore * 0.2;
alpha = 0.6;
x += width / 2;
switch (noteData)
{
case 2:
animation.play('greenholdend');
case 3:
animation.play('redholdend');
case 1:
animation.play('blueholdend');
case 0:
animation.play('purpleholdend');
}
updateHitbox();
x -= width / 2;
if (PlayState.curStage.startsWith('school'))
x += 30;
if (prevNote.isSustainNote)
{
switch (prevNote.noteData)
{
case 0:
prevNote.animation.play('purplehold');
case 1:
prevNote.animation.play('bluehold');
case 2:
prevNote.animation.play('greenhold');
case 3:
prevNote.animation.play('redhold');
}
if(FlxG.save.data.scrollSpeed != 1)
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * FlxG.save.data.scrollSpeed;
else
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed;
prevNote.updateHitbox();
// prevNote.setGraphicSize();
}
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (mustPress)
{
// ass
if (isSustainNote)
{
if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5)
&& strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5))
canBeHit = true;
else
canBeHit = false;
}
else
{
if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset
&& strumTime < Conductor.songPosition + Conductor.safeZoneOffset)
canBeHit = true;
else
canBeHit = false;
}
if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset * Conductor.timeScale && !wasGoodHit)
tooLate = true;
}
else
{
canBeHit = false;
if (strumTime <= Conductor.songPosition)
wasGoodHit = true;
}
if (tooLate)
{
if (alpha > 0.3)
alpha = 0.3;
}
}
}

View File

@ -0,0 +1,39 @@
import flixel.util.FlxColor;
import openfl.display.Sprite;
import flixel.FlxSprite;
/**
* designed to draw a Open FL Sprite as a FlxSprite (to allow layering and auto sizing for haxe flixel cameras)
* Custom made for Kade Engine
*/
class OFLSprite extends FlxSprite
{
public var flSprite:Sprite;
public function new(x,y,width,height,Sprite:Sprite)
{
super(x,y);
makeGraphic(width,height,FlxColor.TRANSPARENT);
flSprite = Sprite;
pixels.draw(flSprite);
}
private var _frameCount:Int = 0;
override function update(elapsed:Float)
{
if (_frameCount != 2)
{
pixels.draw(flSprite);
_frameCount++;
}
}
public function updateDisplay()
{
pixels.draw(flSprite);
}
}

678
source - Copy/Options.hx Normal file
View File

@ -0,0 +1,678 @@
package;
import lime.app.Application;
import lime.system.DisplayMode;
import flixel.util.FlxColor;
import Controls.KeyboardScheme;
import flixel.FlxG;
import openfl.display.FPS;
import openfl.Lib;
class OptionCategory
{
private var _options:Array<Option> = new Array<Option>();
public final function getOptions():Array<Option>
{
return _options;
}
public final function addOption(opt:Option)
{
_options.push(opt);
}
public final function removeOption(opt:Option)
{
_options.remove(opt);
}
private var _name:String = "New Category";
public final function getName() {
return _name;
}
public function new (catName:String, options:Array<Option>)
{
_name = catName;
_options = options;
}
}
class Option
{
public function new()
{
display = updateDisplay();
}
private var description:String = "";
private var display:String;
private var acceptValues:Bool = false;
public final function getDisplay():String
{
return display;
}
public final function getAccept():Bool
{
return acceptValues;
}
public final function getDescription():String
{
return description;
}
public function getValue():String { return throw "stub!"; };
// Returns whether the label is to be updated.
public function press():Bool { return throw "stub!"; }
private function updateDisplay():String { return throw "stub!"; }
public function left():Bool { return throw "stub!"; }
public function right():Bool { return throw "stub!"; }
}
class DFJKOption extends Option
{
private var controls:Controls;
public function new(controls:Controls)
{
super();
this.controls = controls;
}
public override function press():Bool
{
OptionsMenu.instance.openSubState(new KeyBindMenu());
return false;
}
private override function updateDisplay():String
{
return "Key Bindings";
}
}
class CpuStrums extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.cpuStrums = !FlxG.save.data.cpuStrums;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return FlxG.save.data.cpuStrums ? "Light CPU Strums" : "CPU Strums stay static";
}
}
class DownscrollOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.downscroll = !FlxG.save.data.downscroll;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return FlxG.save.data.downscroll ? "Downscroll" : "Upscroll";
}
}
class GhostTapOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.ghost = !FlxG.save.data.ghost;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return FlxG.save.data.ghost ? "Ghost Tapping" : "No Ghost Tapping";
}
}
class AccuracyOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.accuracyDisplay = !FlxG.save.data.accuracyDisplay;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Accuracy " + (!FlxG.save.data.accuracyDisplay ? "off" : "on");
}
}
class SongPositionOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.songPosition = !FlxG.save.data.songPosition;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Song Position " + (!FlxG.save.data.songPosition ? "off" : "on");
}
}
class DistractionsAndEffectsOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.distractions = !FlxG.save.data.distractions;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Distractions " + (!FlxG.save.data.distractions ? "off" : "on");
}
}
class ResetButtonOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.resetButton = !FlxG.save.data.resetButton;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Reset Button " + (!FlxG.save.data.resetButton ? "off" : "on");
}
}
class FlashingLightsOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.flashing = !FlxG.save.data.flashing;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Flashing Lights " + (!FlxG.save.data.flashing ? "off" : "on");
}
}
class ShowInput extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.inputShow = !FlxG.save.data.inputShow;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return (FlxG.save.data.inputShow ? "Extended Score Info" : "Minimalized Info");
}
}
class Judgement extends Option
{
public function new(desc:String)
{
super();
description = desc;
acceptValues = true;
}
public override function press():Bool
{
return true;
}
private override function updateDisplay():String
{
return "Safe Frames";
}
override function left():Bool {
if (Conductor.safeFrames == 1)
return false;
Conductor.safeFrames -= 1;
FlxG.save.data.frames = Conductor.safeFrames;
Conductor.recalculateTimings();
return true;
}
override function getValue():String {
return "Safe Frames: " + Conductor.safeFrames +
" - SIK: " + HelperFunctions.truncateFloat(22 * Conductor.timeScale, 0) +
"ms GD: " + HelperFunctions.truncateFloat(45 * Conductor.timeScale, 0) +
"ms BD: " + HelperFunctions.truncateFloat(135 * Conductor.timeScale, 0) +
"ms SHT: " + HelperFunctions.truncateFloat(155 * Conductor.timeScale, 0) +
"ms TOTAL: " + HelperFunctions.truncateFloat(Conductor.safeZoneOffset,0) + "ms";
}
override function right():Bool {
if (Conductor.safeFrames == 20)
return false;
Conductor.safeFrames += 1;
FlxG.save.data.frames = Conductor.safeFrames;
Conductor.recalculateTimings();
return true;
}
}
class FPSOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.fps = !FlxG.save.data.fps;
(cast (Lib.current.getChildAt(0), Main)).toggleFPS(FlxG.save.data.fps);
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "FPS Counter " + (!FlxG.save.data.fps ? "off" : "on");
}
}
class ScoreScreen extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.scoreScreen = !FlxG.save.data.scoreScreen;
return true;
}
private override function updateDisplay():String
{
return (FlxG.save.data.scoreScreen ? "Show Score Screen" : "No Score Screen");
}
}
class FPSCapOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
acceptValues = true;
}
public override function press():Bool
{
return false;
}
private override function updateDisplay():String
{
return "FPS Cap";
}
override function right():Bool {
if (FlxG.save.data.fpsCap >= 290)
{
FlxG.save.data.fpsCap = 290;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(290);
}
else
FlxG.save.data.fpsCap = FlxG.save.data.fpsCap + 10;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
return true;
}
override function left():Bool {
if (FlxG.save.data.fpsCap > 290)
FlxG.save.data.fpsCap = 290;
else if (FlxG.save.data.fpsCap < 60)
FlxG.save.data.fpsCap = Application.current.window.displayMode.refreshRate;
else
FlxG.save.data.fpsCap = FlxG.save.data.fpsCap - 10;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
return true;
}
override function getValue():String
{
return "Current FPS Cap: " + FlxG.save.data.fpsCap +
(FlxG.save.data.fpsCap == Application.current.window.displayMode.refreshRate ? "Hz (Refresh Rate)" : "");
}
}
class ScrollSpeedOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
acceptValues = true;
}
public override function press():Bool
{
return false;
}
private override function updateDisplay():String
{
return "Scroll Speed";
}
override function right():Bool {
FlxG.save.data.scrollSpeed += 0.1;
if (FlxG.save.data.scrollSpeed < 1)
FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.scrollSpeed > 4)
FlxG.save.data.scrollSpeed = 4;
return true;
}
override function getValue():String {
return "Current Scroll Speed: " + HelperFunctions.truncateFloat(FlxG.save.data.scrollSpeed,1);
}
override function left():Bool {
FlxG.save.data.scrollSpeed -= 0.1;
if (FlxG.save.data.scrollSpeed < 1)
FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.scrollSpeed > 4)
FlxG.save.data.scrollSpeed = 4;
return true;
}
}
class RainbowFPSOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.fpsRain = !FlxG.save.data.fpsRain;
(cast (Lib.current.getChildAt(0), Main)).changeFPSColor(FlxColor.WHITE);
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "FPS Rainbow " + (!FlxG.save.data.fpsRain ? "off" : "on");
}
}
class NPSDisplayOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.npsDisplay = !FlxG.save.data.npsDisplay;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "NPS Display " + (!FlxG.save.data.npsDisplay ? "off" : "on");
}
}
class ReplayOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
trace("switch");
FlxG.switchState(new LoadReplayState());
return false;
}
private override function updateDisplay():String
{
return "Load replays";
}
}
class AccuracyDOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.accuracyMod = FlxG.save.data.accuracyMod == 1 ? 0 : 1;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Accuracy Mode: " + (FlxG.save.data.accuracyMod == 0 ? "Accurate" : "Complex");
}
}
class CustomizeGameplay extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
trace("switch");
FlxG.switchState(new GameplayCustomizeState());
return false;
}
private override function updateDisplay():String
{
return "Customize Gameplay";
}
}
class WatermarkOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
Main.watermarks = !Main.watermarks;
FlxG.save.data.watermark = Main.watermarks;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Watermarks " + (Main.watermarks ? "on" : "off");
}
}
class OffsetMenu extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
trace("switch");
var poop:String = Highscore.formatSong("Tutorial", 1);
PlayState.SONG = Song.loadFromJson(poop, "Tutorial");
PlayState.isStoryMode = false;
PlayState.storyDifficulty = 0;
PlayState.storyWeek = 0;
PlayState.offsetTesting = true;
trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
return false;
}
private override function updateDisplay():String
{
return "Time your offset";
}
}
class BotPlay extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.botplay = !FlxG.save.data.botplay;
trace('BotPlay : ' + FlxG.save.data.botplay);
display = updateDisplay();
return true;
}
private override function updateDisplay():String
return "BotPlay " + (FlxG.save.data.botplay ? "on" : "off");
}
class CamZoomOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.camzoom = !FlxG.save.data.camzoom;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "Camera Zoom " + (!FlxG.save.data.camzoom ? "off" : "on");
}
}

View File

@ -0,0 +1,294 @@
package;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import openfl.Lib;
import Options;
import Controls.Control;
import flash.text.TextField;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.input.keyboard.FlxKey;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import lime.utils.Assets;
class OptionsMenu extends MusicBeatState
{
public static var instance:OptionsMenu;
var selector:FlxText;
var curSelected:Int = 0;
var options:Array<OptionCategory> = [
new OptionCategory("Gameplay", [
new DFJKOption(controls),
new DownscrollOption("Change the layout of the strumline."),
new GhostTapOption("Ghost Tapping is when you tap a direction and it doesn't give you a miss."),
new Judgement("Customize your Hit Timings (LEFT or RIGHT)"),
#if desktop
new FPSCapOption("Cap your FPS"),
#end
new ScrollSpeedOption("Change your scroll speed (1 = Chart dependent)"),
new AccuracyDOption("Change how accuracy is calculated. (Accurate = Simple, Complex = Milisecond Based)"),
new ResetButtonOption("Toggle pressing R to gameover."),
// new OffsetMenu("Get a note offset based off of your inputs!"),
new CustomizeGameplay("Drag'n'Drop Gameplay Modules around to your preference")
]),
new OptionCategory("Appearance", [
new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay."),
new CamZoomOption("Toggle the camera zoom in-game."),
#if desktop
new RainbowFPSOption("Make the FPS Counter Rainbow"),
new AccuracyOption("Display accuracy information."),
new NPSDisplayOption("Shows your current Notes Per Second."),
new SongPositionOption("Show the songs current position (as a bar)"),
new CpuStrums("CPU's strumline lights up when a note hits it."),
#end
]),
new OptionCategory("Misc", [
#if desktop
new FPSOption("Toggle the FPS Counter"),
new ReplayOption("View replays"),
#end
new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."),
new WatermarkOption("Enable and disable all watermarks from the engine."),
new BotPlay("Showcase your charts and mods with autoplay."),
new ScoreScreen("Show the score screen after the end of a song"),
new ShowInput("Display every single input in the score screen.")
])
];
public var acceptInput:Bool = true;
private var currentDescription:String = "";
private var grpControls:FlxTypedGroup<Alphabet>;
public static var versionShit:FlxText;
var currentSelectedCat:OptionCategory;
var blackBorder:FlxSprite;
override function create()
{
instance = this;
var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image("menuDesat"));
menuBG.color = 0xFFea71fd;
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
menuBG.updateHitbox();
menuBG.screenCenter();
menuBG.antialiasing = true;
add(menuBG);
grpControls = new FlxTypedGroup<Alphabet>();
add(grpControls);
for (i in 0...options.length)
{
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, options[i].getName(), true, false, true);
controlLabel.isMenuItem = true;
controlLabel.targetY = i;
grpControls.add(controlLabel);
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
}
currentDescription = "none";
versionShit = new FlxText(5, FlxG.height + 40, 0, "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription, 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
blackBorder = new FlxSprite(-30,FlxG.height + 40).makeGraphic((Std.int(versionShit.width + 900)),Std.int(versionShit.height + 600),FlxColor.BLACK);
blackBorder.alpha = 0.5;
add(blackBorder);
add(versionShit);
FlxTween.tween(versionShit,{y: FlxG.height - 18},2,{ease: FlxEase.elasticInOut});
FlxTween.tween(blackBorder,{y: FlxG.height - 18},2, {ease: FlxEase.elasticInOut});
super.create();
}
var isCat:Bool = false;
override function update(elapsed:Float)
{
super.update(elapsed);
if (acceptInput)
{
if (controls.BACK && !isCat)
FlxG.switchState(new MainMenuState());
else if (controls.BACK)
{
isCat = false;
grpControls.clear();
for (i in 0...options.length)
{
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, options[i].getName(), true, false);
controlLabel.isMenuItem = true;
controlLabel.targetY = i;
grpControls.add(controlLabel);
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
}
curSelected = 0;
changeSelection(curSelected);
}
if (controls.UP_P)
changeSelection(-1);
if (controls.DOWN_P)
changeSelection(1);
if (isCat)
{
if (currentSelectedCat.getOptions()[curSelected].getAccept())
{
if (FlxG.keys.pressed.SHIFT)
{
if (FlxG.keys.pressed.RIGHT)
currentSelectedCat.getOptions()[curSelected].right();
if (FlxG.keys.pressed.LEFT)
currentSelectedCat.getOptions()[curSelected].left();
}
else
{
if (FlxG.keys.justPressed.RIGHT)
currentSelectedCat.getOptions()[curSelected].right();
if (FlxG.keys.justPressed.LEFT)
currentSelectedCat.getOptions()[curSelected].left();
}
}
else
{
if (FlxG.keys.pressed.SHIFT)
{
if (FlxG.keys.justPressed.RIGHT)
FlxG.save.data.offset += 0.1;
else if (FlxG.keys.justPressed.LEFT)
FlxG.save.data.offset -= 0.1;
}
else if (FlxG.keys.pressed.RIGHT)
FlxG.save.data.offset += 0.1;
else if (FlxG.keys.pressed.LEFT)
FlxG.save.data.offset -= 0.1;
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
}
if (currentSelectedCat.getOptions()[curSelected].getAccept())
versionShit.text = currentSelectedCat.getOptions()[curSelected].getValue() + " - Description - " + currentDescription;
else
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
}
else
{
if (FlxG.keys.pressed.SHIFT)
{
if (FlxG.keys.justPressed.RIGHT)
FlxG.save.data.offset += 0.1;
else if (FlxG.keys.justPressed.LEFT)
FlxG.save.data.offset -= 0.1;
}
else if (FlxG.keys.pressed.RIGHT)
FlxG.save.data.offset += 0.1;
else if (FlxG.keys.pressed.LEFT)
FlxG.save.data.offset -= 0.1;
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
}
if (controls.RESET)
FlxG.save.data.offset = 0;
if (controls.ACCEPT)
{
if (isCat)
{
if (currentSelectedCat.getOptions()[curSelected].press()) {
grpControls.remove(grpControls.members[curSelected]);
var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, currentSelectedCat.getOptions()[curSelected].getDisplay(), true, false);
ctrl.isMenuItem = true;
grpControls.add(ctrl);
}
}
else
{
currentSelectedCat = options[curSelected];
isCat = true;
grpControls.clear();
for (i in 0...currentSelectedCat.getOptions().length)
{
var controlLabel:Alphabet = new Alphabet(0, (70 * i) + 30, currentSelectedCat.getOptions()[i].getDisplay(), true, false);
controlLabel.isMenuItem = true;
controlLabel.targetY = i;
grpControls.add(controlLabel);
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
}
curSelected = 0;
}
changeSelection(curSelected);
}
}
FlxG.save.flush();
}
var isSettingControl:Bool = false;
function changeSelection(change:Int = 0)
{
#if !switch
// NGio.logEvent("Fresh");
#end
FlxG.sound.play(Paths.sound("scrollMenu"), 0.4);
curSelected += change;
if (curSelected < 0)
curSelected = grpControls.length - 1;
if (curSelected >= grpControls.length)
curSelected = 0;
if (isCat)
currentDescription = currentSelectedCat.getOptions()[curSelected].getDescription();
else
currentDescription = "Please select a category";
if (isCat)
{
if (currentSelectedCat.getOptions()[curSelected].getAccept())
versionShit.text = currentSelectedCat.getOptions()[curSelected].getValue() + " - Description - " + currentDescription;
else
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
}
else
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
// selector.y = (70 * curSelected) + 30;
var bullShit:Int = 0;
for (item in grpControls.members)
{
item.targetY = bullShit - curSelected;
bullShit++;
item.alpha = 0.6;
// item.setGraphicSize(Std.int(item.width * 0.8));
if (item.targetY == 0)
{
item.alpha = 1;
// item.setGraphicSize(Std.int(item.width));
}
}
}
}

View File

@ -0,0 +1,70 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
class OptionsSubState extends MusicBeatSubstate
{
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls'];
var selector:FlxSprite;
var curSelected:Int = 0;
var grpOptionsTexts:FlxTypedGroup<FlxText>;
public function new()
{
super();
grpOptionsTexts = new FlxTypedGroup<FlxText>();
add(grpOptionsTexts);
selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED);
add(selector);
for (i in 0...textMenuItems.length)
{
var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32);
optionText.ID = i;
grpOptionsTexts.add(optionText);
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (controls.UP_P)
curSelected -= 1;
if (controls.DOWN_P)
curSelected += 1;
if (curSelected < 0)
curSelected = textMenuItems.length - 1;
if (curSelected >= textMenuItems.length)
curSelected = 0;
grpOptionsTexts.forEach(function(txt:FlxText)
{
txt.color = FlxColor.WHITE;
if (txt.ID == curSelected)
txt.color = FlxColor.YELLOW;
});
if (controls.ACCEPT)
{
switch (textMenuItems[curSelected])
{
case "Controls":
FlxG.state.closeSubState();
FlxG.state.openSubState(new ControlsSubState());
}
}
}
}

View File

@ -0,0 +1,98 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxSubState;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import lime.app.Application;
class OutdatedSubState extends MusicBeatState
{
public static var leftState:Bool = false;
public static var needVer:String = "IDFK LOL";
public static var currChanges:String = "dk";
private var bgColors:Array<String> = [
'#314d7f',
'#4e7093',
'#70526e',
'#594465'
];
private var colorRotation:Int = 1;
override function create()
{
super.create();
var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image('week54prototype', 'shared'));
bg.scale.x *= 1.55;
bg.scale.y *= 1.55;
bg.screenCenter();
add(bg);
var kadeLogo:FlxSprite = new FlxSprite(FlxG.width, 0).loadGraphic(Paths.image('KadeEngineLogo'));
kadeLogo.scale.y = 0.3;
kadeLogo.scale.x = 0.3;
kadeLogo.x -= kadeLogo.frameHeight;
kadeLogo.y -= 180;
kadeLogo.alpha = 0.8;
add(kadeLogo);
var txt:FlxText = new FlxText(0, 0, FlxG.width,
"Your Kade Engine is outdated!\nYou are on "
+ MainMenuState.kadeEngineVer
+ "\nwhile the most recent version is " + needVer + "."
+ "\n\nWhat's new:\n\n"
+ currChanges
+ "\n& more changes and bugfixes in the full changelog"
+ "\n\nPress Space to view the full changelog and update\nor ESCAPE to ignore this",
32);
txt.setFormat("VCR OSD Mono", 32, FlxColor.fromRGB(200, 200, 200), CENTER);
txt.borderColor = FlxColor.BLACK;
txt.borderSize = 3;
txt.borderStyle = FlxTextBorderStyle.OUTLINE;
txt.screenCenter();
add(txt);
FlxTween.color(bg, 2, bg.color, FlxColor.fromString(bgColors[colorRotation]));
FlxTween.angle(kadeLogo, kadeLogo.angle, -10, 2, {ease: FlxEase.quartInOut});
new FlxTimer().start(2, function(tmr:FlxTimer)
{
FlxTween.color(bg, 2, bg.color, FlxColor.fromString(bgColors[colorRotation]));
if(colorRotation < (bgColors.length - 1)) colorRotation++;
else colorRotation = 0;
}, 0);
new FlxTimer().start(2, function(tmr:FlxTimer)
{
if(kadeLogo.angle == -10) FlxTween.angle(kadeLogo, kadeLogo.angle, 10, 2, {ease: FlxEase.quartInOut});
else FlxTween.angle(kadeLogo, kadeLogo.angle, -10, 2, {ease: FlxEase.quartInOut});
}, 0);
new FlxTimer().start(0.8, function(tmr:FlxTimer)
{
if(kadeLogo.alpha == 0.8) FlxTween.tween(kadeLogo, {alpha: 1}, 0.8, {ease: FlxEase.quartInOut});
else FlxTween.tween(kadeLogo, {alpha: 0.8}, 0.8, {ease: FlxEase.quartInOut});
}, 0);
}
override function update(elapsed:Float)
{
if (controls.ACCEPT)
{
fancyOpenURL("https://kadedev.github.io/Kade-Engine/changelogs/changelog-" + needVer);
}
if (controls.BACK)
{
leftState = true;
FlxG.switchState(new MainMenuState());
}
super.update(elapsed);
}
}

View File

@ -0,0 +1,33 @@
package;
import flixel.system.FlxAssets.FlxShader;
class OverlayShader extends FlxShader
{
@:glFragmentSource('
#pragma header
uniform vec4 uBlendColor;
vec3 blendLighten(base:Vec3, blend:Vec3) : Vec3 {
return mix(
1.0 - 2.0 * (1.0 - base) * (1.0 - blend),
2.0 * base * blend,
step( base, vec3(0.5) )
);
}
vec4 blendLighten(vec4 base, vec4 blend, float opacity)
{
return (blendLighten(base, blend) * opacity + base * (1.0 - opacity));
}
void main()
{
vec4 base = texture2D(bitmap, openfl_TextureCoordv);
gl_FragColor = blendLighten(base, uBlendColor, uBlendColor.a);
}')
public function new()
{
super();
}
}

137
source - Copy/Paths.hx Normal file
View File

@ -0,0 +1,137 @@
package;
import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames;
import openfl.utils.AssetType;
import openfl.utils.Assets as OpenFlAssets;
class Paths
{
inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
static var currentLevel:String;
static public function setCurrentLevel(name:String)
{
currentLevel = name.toLowerCase();
}
static function getPath(file:String, type:AssetType, library:Null<String>)
{
if (library != null)
return getLibraryPath(file, library);
if (currentLevel != null)
{
var levelPath = getLibraryPathForce(file, currentLevel);
if (OpenFlAssets.exists(levelPath, type))
return levelPath;
levelPath = getLibraryPathForce(file, "shared");
if (OpenFlAssets.exists(levelPath, type))
return levelPath;
}
return getPreloadPath(file);
}
static public function getLibraryPath(file:String, library = "preload")
{
return if (library == "preload" || library == "default") getPreloadPath(file); else getLibraryPathForce(file, library);
}
inline static function getLibraryPathForce(file:String, library:String)
{
return '$library:assets/$library/$file';
}
inline static function getPreloadPath(file:String)
{
return 'assets/$file';
}
inline static public function file(file:String, type:AssetType = TEXT, ?library:String)
{
return getPath(file, type, library);
}
inline static public function lua(key:String,?library:String)
{
return getPath('data/$key.lua', TEXT, library);
}
inline static public function luaImage(key:String, ?library:String)
{
return getPath('data/$key.png', IMAGE, library);
}
inline static public function txt(key:String, ?library:String)
{
return getPath('data/$key.txt', TEXT, library);
}
inline static public function xml(key:String, ?library:String)
{
return getPath('data/$key.xml', TEXT, library);
}
inline static public function json(key:String, ?library:String)
{
return getPath('data/$key.json', TEXT, library);
}
static public function sound(key:String, ?library:String)
{
return getPath('sounds/$key.$SOUND_EXT', SOUND, library);
}
inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String)
{
return sound(key + FlxG.random.int(min, max), library);
}
inline static public function music(key:String, ?library:String)
{
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
}
inline static public function voices(song:String)
{
var songLowercase = StringTools.replace(song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
return 'songs:assets/songs/${songLowercase}/Voices.$SOUND_EXT';
}
inline static public function inst(song:String)
{
var songLowercase = StringTools.replace(song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
return 'songs:assets/songs/${songLowercase}/Inst.$SOUND_EXT';
}
inline static public function image(key:String, ?library:String)
{
return getPath('images/$key.png', IMAGE, library);
}
inline static public function font(key:String)
{
return 'assets/fonts/$key';
}
inline static public function getSparrowAtlas(key:String, ?library:String)
{
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
}
inline static public function getPackerAtlas(key:String, ?library:String)
{
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
}
}

View File

@ -0,0 +1,275 @@
package;
import openfl.Lib;
#if windows
import llua.Lua;
#end
import Controls.Control;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxSubState;
import flixel.addons.transition.FlxTransitionableState;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.input.keyboard.FlxKey;
import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
class PauseSubState extends MusicBeatSubstate
{
var grpMenuShit:FlxTypedGroup<Alphabet>;
var menuItems:Array<String> = ['Resume', 'Restart Song', 'Exit to menu'];
var curSelected:Int = 0;
var pauseMusic:FlxSound;
var perSongOffset:FlxText;
var offsetChanged:Bool = false;
public function new(x:Float, y:Float)
{
super();
if (PlayState.instance.useVideo)
{
menuItems.remove("Resume");
if (GlobalVideo.get().playing)
GlobalVideo.get().pause();
}
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
pauseMusic.volume = 0;
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));
FlxG.sound.list.add(pauseMusic);
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.alpha = 0;
bg.scrollFactor.set();
add(bg);
var levelInfo:FlxText = new FlxText(20, 15, 0, "", 32);
levelInfo.text += PlayState.SONG.song;
levelInfo.scrollFactor.set();
levelInfo.setFormat(Paths.font("vcr.ttf"), 32);
levelInfo.updateHitbox();
add(levelInfo);
var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, "", 32);
levelDifficulty.text += CoolUtil.difficultyFromInt(PlayState.storyDifficulty).toUpperCase();
levelDifficulty.scrollFactor.set();
levelDifficulty.setFormat(Paths.font('vcr.ttf'), 32);
levelDifficulty.updateHitbox();
add(levelDifficulty);
levelDifficulty.alpha = 0;
levelInfo.alpha = 0;
levelInfo.x = FlxG.width - (levelInfo.width + 20);
levelDifficulty.x = FlxG.width - (levelDifficulty.width + 20);
FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});
FlxTween.tween(levelInfo, {alpha: 1, y: 20}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3});
FlxTween.tween(levelDifficulty, {alpha: 1, y: levelDifficulty.y + 5}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.5});
grpMenuShit = new FlxTypedGroup<Alphabet>();
add(grpMenuShit);
perSongOffset = new FlxText(5, FlxG.height - 18, 0, "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.', 12);
perSongOffset.scrollFactor.set();
perSongOffset.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
#if cpp
add(perSongOffset);
#end
for (i in 0...menuItems.length)
{
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false);
songText.isMenuItem = true;
songText.targetY = i;
grpMenuShit.add(songText);
}
changeSelection();
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
}
override function update(elapsed:Float)
{
if (pauseMusic.volume < 0.5)
pauseMusic.volume += 0.01 * elapsed;
super.update(elapsed);
if (PlayState.instance.useVideo)
menuItems.remove('Resume');
var upP = controls.UP_P;
var downP = controls.DOWN_P;
var leftP = controls.LEFT_P;
var rightP = controls.RIGHT_P;
var accepted = controls.ACCEPT;
var oldOffset:Float = 0;
// pre lowercasing the song name (update)
var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase();
switch (songLowercase) {
case 'dad-battle': songLowercase = 'dadbattle';
case 'philly-nice': songLowercase = 'philly';
}
var songPath = 'assets/data/' + songLowercase + '/';
if (upP)
{
changeSelection(-1);
}else if (downP)
{
changeSelection(1);
}
#if cpp
else if (leftP)
{
oldOffset = PlayState.songOffset;
PlayState.songOffset -= 1;
sys.FileSystem.rename(songPath + oldOffset + '.offset', songPath + PlayState.songOffset + '.offset');
perSongOffset.text = "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.';
// Prevent loop from happening every single time the offset changes
if(!offsetChanged)
{
grpMenuShit.clear();
menuItems = ['Restart Song', 'Exit to menu'];
for (i in 0...menuItems.length)
{
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false);
songText.isMenuItem = true;
songText.targetY = i;
grpMenuShit.add(songText);
}
changeSelection();
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
offsetChanged = true;
}
}else if (rightP)
{
oldOffset = PlayState.songOffset;
PlayState.songOffset += 1;
sys.FileSystem.rename(songPath + oldOffset + '.offset', songPath + PlayState.songOffset + '.offset');
perSongOffset.text = "Additive Offset (Left, Right): " + PlayState.songOffset + " - Description - " + 'Adds value to global offset, per song.';
if(!offsetChanged)
{
grpMenuShit.clear();
menuItems = ['Restart Song', 'Exit to menu'];
for (i in 0...menuItems.length)
{
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, menuItems[i], true, false);
songText.isMenuItem = true;
songText.targetY = i;
grpMenuShit.add(songText);
}
changeSelection();
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
offsetChanged = true;
}
}
#end
if (accepted)
{
var daSelected:String = menuItems[curSelected];
switch (daSelected)
{
case "Resume":
close();
case "Restart Song":
if (PlayState.instance.useVideo)
{
GlobalVideo.get().stop();
PlayState.instance.remove(PlayState.instance.videoSprite);
PlayState.instance.removedVideo = true;
}
FlxG.resetState();
case "Exit to menu":
if (PlayState.instance.useVideo)
{
GlobalVideo.get().stop();
PlayState.instance.remove(PlayState.instance.videoSprite);
PlayState.instance.removedVideo = true;
}
if(PlayState.loadRep)
{
FlxG.save.data.botplay = false;
FlxG.save.data.scrollSpeed = 1;
FlxG.save.data.downscroll = false;
}
PlayState.loadRep = false;
#if windows
if (PlayState.luaModchart != null)
{
PlayState.luaModchart.die();
PlayState.luaModchart = null;
}
#end
if (FlxG.save.data.fpsCap > 290)
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(290);
FlxG.switchState(new MainMenuState());
}
}
if (FlxG.keys.justPressed.J)
{
// for reference later!
// PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxKey.J, null);
}
}
override function destroy()
{
pauseMusic.destroy();
super.destroy();
}
function changeSelection(change:Int = 0):Void
{
curSelected += change;
if (curSelected < 0)
curSelected = menuItems.length - 1;
if (curSelected >= menuItems.length)
curSelected = 0;
var bullShit:Int = 0;
for (item in grpMenuShit.members)
{
item.targetY = bullShit - curSelected;
bullShit++;
item.alpha = 0.6;
// item.setGraphicSize(Std.int(item.width * 0.8));
if (item.targetY == 0)
{
item.alpha = 1;
// item.setGraphicSize(Std.int(item.width));
}
}
}
}

3821
source - Copy/PlayState.hx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
class PlayStateChangeables
{
public static var useDownscroll:Bool;
public static var safeFrames:Int;
public static var scrollSpeed:Float;
public static var botPlay:Bool;
}

View File

@ -0,0 +1,89 @@
package;
import Controls;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.util.FlxSignal;
// import ui.DeviceManager;
// import props.Player;
class PlayerSettings
{
static public var numPlayers(default, null) = 0;
static public var numAvatars(default, null) = 0;
static public var player1(default, null):PlayerSettings;
static public var player2(default, null):PlayerSettings;
#if (haxe >= "4.0.0")
static public final onAvatarAdd = new FlxTypedSignal<PlayerSettings->Void>();
static public final onAvatarRemove = new FlxTypedSignal<PlayerSettings->Void>();
#else
static public var onAvatarAdd = new FlxTypedSignal<PlayerSettings->Void>();
static public var onAvatarRemove = new FlxTypedSignal<PlayerSettings->Void>();
#end
public var id(default, null):Int;
#if (haxe >= "4.0.0")
public final controls:Controls;
#else
public var controls:Controls;
#end
// public var avatar:Player;
// public var camera(get, never):PlayCamera;
function new(id, scheme)
{
this.id = id;
this.controls = new Controls('player$id', scheme);
}
public function setKeyboardScheme(scheme)
{
controls.setKeyboardScheme(scheme);
}
static public function init():Void
{
if (player1 == null)
{
player1 = new PlayerSettings(0, Solo);
++numPlayers;
}
var numGamepads = FlxG.gamepads.numActiveGamepads;
if (numGamepads > 0)
{
var gamepad = FlxG.gamepads.getByID(0);
if (gamepad == null)
throw 'Unexpected null gamepad. id:0';
player1.controls.addDefaultGamepad(0);
}
if (numGamepads > 1)
{
if (player2 == null)
{
player2 = new PlayerSettings(1, None);
++numPlayers;
}
var gamepad = FlxG.gamepads.getByID(1);
if (gamepad == null)
throw 'Unexpected null gamepad. id:0';
player2.controls.addDefaultGamepad(1);
}
// DeviceManager.init();
}
static public function reset()
{
player1 = null;
player2 = null;
numPlayers = 0;
}
}

151
source - Copy/Ratings.hx Normal file
View File

@ -0,0 +1,151 @@
import flixel.FlxG;
class Ratings
{
public static function GenerateLetterRank(accuracy:Float) // generate a letter ranking
{
var ranking:String = "N/A";
if(FlxG.save.data.botplay && !PlayState.loadRep)
ranking = "BotPlay";
if (PlayState.misses == 0 && PlayState.bads == 0 && PlayState.shits == 0 && PlayState.goods == 0) // Marvelous (SICK) Full Combo
ranking = "(MFC)";
else if (PlayState.misses == 0 && PlayState.bads == 0 && PlayState.shits == 0 && PlayState.goods >= 1) // Good Full Combo (Nothing but Goods & Sicks)
ranking = "(GFC)";
else if (PlayState.misses == 0) // Regular FC
ranking = "(FC)";
else if (PlayState.misses < 10) // Single Digit Combo Breaks
ranking = "(SDCB)";
else
ranking = "(Clear)";
// WIFE TIME :)))) (based on Wife3)
var wifeConditions:Array<Bool> = [
accuracy >= 99.9935, // AAAAA
accuracy >= 99.980, // AAAA:
accuracy >= 99.970, // AAAA.
accuracy >= 99.955, // AAAA
accuracy >= 99.90, // AAA:
accuracy >= 99.80, // AAA.
accuracy >= 99.70, // AAA
accuracy >= 99, // AA:
accuracy >= 96.50, // AA.
accuracy >= 93, // AA
accuracy >= 90, // A:
accuracy >= 85, // A.
accuracy >= 80, // A
accuracy >= 70, // B
accuracy >= 60, // C
accuracy < 60 // D
];
for(i in 0...wifeConditions.length)
{
var b = wifeConditions[i];
if (b)
{
switch(i)
{
case 0:
ranking += " AAAAA";
case 1:
ranking += " AAAA:";
case 2:
ranking += " AAAA.";
case 3:
ranking += " AAAA";
case 4:
ranking += " AAA:";
case 5:
ranking += " AAA.";
case 6:
ranking += " AAA";
case 7:
ranking += " AA:";
case 8:
ranking += " AA.";
case 9:
ranking += " AA";
case 10:
ranking += " A:";
case 11:
ranking += " A.";
case 12:
ranking += " A";
case 13:
ranking += " B";
case 14:
ranking += " C";
case 15:
ranking += " D";
}
break;
}
}
if (accuracy == 0)
ranking = "N/A";
else if(FlxG.save.data.botplay && !PlayState.loadRep)
ranking = "BotPlay";
return ranking;
}
public static function CalculateRating(noteDiff:Float, ?customSafeZone:Float):String // Generate a judgement through some timing shit
{
var customTimeScale = Conductor.timeScale;
if (customSafeZone != null)
customTimeScale = customSafeZone / 166;
// trace(customTimeScale + ' vs ' + Conductor.timeScale);
// I HATE THIS IF CONDITION
// IF LEMON SEES THIS I'M SORRY :(
// trace('Hit Info\nDifference: ' + noteDiff + '\nZone: ' + Conductor.safeZoneOffset * 1.5 + "\nTS: " + customTimeScale + "\nLate: " + 155 * customTimeScale);
if (FlxG.save.data.botplay && !PlayState.loadRep)
return "sick"; // FUNNY
var rating = checkRating(noteDiff,customTimeScale);
return rating;
}
public static function checkRating(ms:Float, ts:Float)
{
var rating = "sick";
if (ms <= 166 * ts && ms >= 135 * ts)
rating = "shit";
if (ms < 135 * ts && ms >= 90 * ts)
rating = "bad";
if (ms < 90 * ts && ms >= 45 * ts)
rating = "good";
if (ms < 45 * ts && ms >= -45 * ts)
rating = "sick";
if (ms > -90 * ts && ms <= -45 * ts)
rating = "good";
if (ms > -135 * ts && ms <= -90 * ts)
rating = "bad";
if (ms > -166 * ts && ms <= -135 * ts)
rating = "shit";
return rating;
}
public static function CalculateRanking(score:Int,scoreDef:Int,nps:Int,maxNPS:Int,accuracy:Float):String
{
return
(FlxG.save.data.npsDisplay ? // NPS Toggle
"NPS: " + nps + " (Max " + maxNPS + ")" + (!PlayStateChangeables.botPlay || PlayState.loadRep ? " | " : "") : "") + // NPS
(!PlayStateChangeables.botPlay || PlayState.loadRep ? "Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score
(FlxG.save.data.accuracyDisplay ? // Accuracy Toggle
" | Combo Breaks:" + PlayState.misses + // Misses/Combo Breaks
" | Accuracy:" + (PlayStateChangeables.botPlay && !PlayState.loadRep ? "N/A" : HelperFunctions.truncateFloat(accuracy, 2) + " %") + // Accuracy
" | " + GenerateLetterRank(accuracy) : "") : ""); // Letter Rank
}
}

133
source - Copy/Replay.hx Normal file
View File

@ -0,0 +1,133 @@
#if sys
import sys.io.File;
#end
import Controls.Control;
import flixel.FlxG;
import openfl.events.IOErrorEvent;
import openfl.events.Event;
import openfl.net.FileReference;
import lime.utils.Assets;
import haxe.Json;
import flixel.input.keyboard.FlxKey;
import openfl.utils.Dictionary;
class Ana
{
public var hitTime:Float;
public var nearestNote:Array<Dynamic>;
public var hit:Bool;
public var hitJudge:String;
public var key:Int;
public function new(_hitTime:Float,_nearestNote:Array<Dynamic>,_hit:Bool,_hitJudge:String, _key:Int) {
hitTime = _hitTime;
nearestNote = _nearestNote;
hit = _hit;
hitJudge = _hitJudge;
key = _key;
}
}
class Analysis
{
public var anaArray:Array<Ana>;
public function new() {
anaArray = [];
}
}
typedef ReplayJSON =
{
public var replayGameVer:String;
public var timestamp:Date;
public var songName:String;
public var songDiff:Int;
public var songNotes:Array<Dynamic>;
public var songJudgements:Array<String>;
public var noteSpeed:Float;
public var isDownscroll:Bool;
public var sf:Int;
public var ana:Analysis;
}
class Replay
{
public static var version:String = "1.2"; // replay file version
public var path:String = "";
public var replay:ReplayJSON;
public function new(path:String)
{
this.path = path;
replay = {
songName: "No Song Found",
songDiff: 1,
noteSpeed: 1.5,
isDownscroll: false,
songNotes: [],
replayGameVer: version,
timestamp: Date.now(),
sf: Conductor.safeFrames,
ana: new Analysis(),
songJudgements: []
};
}
public static function LoadReplay(path:String):Replay
{
var rep:Replay = new Replay(path);
rep.LoadFromJSON();
trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff);
return rep;
}
public function SaveReplay(notearray:Array<Dynamic>, judge:Array<String>, ana:Analysis)
{
var json = {
"songName": PlayState.SONG.song,
"songDiff": PlayState.storyDifficulty,
"noteSpeed": (FlxG.save.data.scrollSpeed > 1 ? FlxG.save.data.scrollSpeed : PlayState.SONG.speed),
"isDownscroll": FlxG.save.data.downscroll,
"songNotes": notearray,
"songJudgements": judge,
"timestamp": Date.now(),
"replayGameVer": version,
"sf": Conductor.safeFrames,
"ana": ana
};
var data:String = Json.stringify(json);
var time = Date.now().getTime();
#if sys
File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + time + ".kadeReplay", data);
path = "replay-" + PlayState.SONG.song + "-time" + time + ".kadeReplay"; // for score screen shit
LoadFromJSON();
replay.ana = ana;
#end
}
public function LoadFromJSON()
{
#if sys
trace('loading ' + Sys.getCwd() + 'assets/replays/' + path + ' replay...');
try
{
var repl:ReplayJSON = cast Json.parse(File.getContent(Sys.getCwd() + "assets/replays/" + path));
replay = repl;
}
catch(e)
{
trace('failed!\n' + e.message);
}
#end
}
}

View File

@ -0,0 +1,252 @@
package;
import openfl.geom.Matrix;
import openfl.display.BitmapData;
import flixel.system.FlxSound;
import flixel.util.FlxAxes;
import flixel.FlxSubState;
import Options.Option;
import flixel.input.FlxInput;
import flixel.input.keyboard.FlxKey;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.effects.FlxFlicker;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import io.newgrounds.NG;
import lime.app.Application;
import lime.utils.Assets;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.input.FlxKeyManager;
using StringTools;
class ResultsScreen extends FlxSubState
{
public var background:FlxSprite;
public var text:FlxText;
public var anotherBackground:FlxSprite;
public var graph:HitGraph;
public var graphSprite:OFLSprite;
public var comboText:FlxText;
public var contText:FlxText;
public var settingsText:FlxText;
public var music:FlxSound;
public var graphData:BitmapData;
public var ranking:String;
public var accuracy:String;
override function create()
{
background = new FlxSprite(0,0).makeGraphic(FlxG.width,FlxG.height,FlxColor.BLACK);
background.scrollFactor.set();
add(background);
music = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
music.volume = 0;
music.play(false, FlxG.random.int(0, Std.int(music.length / 2)));
background.alpha = 0;
text = new FlxText(20,-55,0,"Song Cleared!");
text.size = 34;
text.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
text.color = FlxColor.WHITE;
text.scrollFactor.set();
add(text);
var score = PlayState.instance.songScore;
if (PlayState.isStoryMode)
{
score = PlayState.campaignScore;
text.text = "Week Cleared!";
}
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\n\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song
');
comboText.size = 28;
comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
comboText.color = FlxColor.WHITE;
comboText.scrollFactor.set();
add(comboText);
contText = new FlxText(FlxG.width - 475,FlxG.height + 50,0,'Press ENTER to continue.');
contText.size = 28;
contText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
contText.color = FlxColor.WHITE;
contText.scrollFactor.set();
add(contText);
anotherBackground = new FlxSprite(FlxG.width - 500,45).makeGraphic(450,240,FlxColor.BLACK);
anotherBackground.scrollFactor.set();
anotherBackground.alpha = 0;
add(anotherBackground);
graph = new HitGraph(FlxG.width - 500,45,495,240);
graph.alpha = 0;
graphSprite = new OFLSprite(FlxG.width - 510,45,460,240,graph);
graphSprite.scrollFactor.set();
graphSprite.alpha = 0;
add(graphSprite);
var sicks = HelperFunctions.truncateFloat(PlayState.sicks / PlayState.goods,1);
var goods = HelperFunctions.truncateFloat(PlayState.goods / PlayState.bads,1);
if (sicks == Math.POSITIVE_INFINITY)
sicks = 0;
if (goods == Math.POSITIVE_INFINITY)
goods = 0;
var mean:Float = 0;
for (i in 0...PlayState.rep.replay.songNotes.length)
{
// 0 = time
// 1 = length
// 2 = type
// 3 = diff
var obj = PlayState.rep.replay.songNotes[i];
// judgement
var obj2 = PlayState.rep.replay.songJudgements[i];
var obj3 = obj[0];
var diff = obj[3];
var judge = obj2;
mean += diff;
if (obj[1] != -1)
graph.addToHistory(diff, judge, obj3);
}
graph.update();
mean = HelperFunctions.truncateFloat(mean / PlayState.rep.replay.songNotes.length,2);
settingsText = new FlxText(20,FlxG.height + 50,0,'SF: ${PlayState.rep.replay.sf} | Ratio (SA/GA): ${Math.round(sicks)}:1 ${Math.round(goods)}:1 | Mean: ${mean}ms | Played on ${PlayState.SONG.song} ${CoolUtil.difficultyFromInt(PlayState.storyDifficulty).toUpperCase()}');
settingsText.size = 16;
settingsText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,2,1);
settingsText.color = FlxColor.WHITE;
settingsText.scrollFactor.set();
add(settingsText);
FlxTween.tween(background, {alpha: 0.5},0.5);
FlxTween.tween(text, {y:20},0.5,{ease: FlxEase.expoInOut});
FlxTween.tween(comboText, {y:145},0.5,{ease: FlxEase.expoInOut});
FlxTween.tween(contText, {y:FlxG.height - 45},0.5,{ease: FlxEase.expoInOut});
FlxTween.tween(settingsText, {y:FlxG.height - 35},0.5,{ease: FlxEase.expoInOut});
FlxTween.tween(anotherBackground, {alpha: 0.6},0.5, {onUpdate: function(tween:FlxTween) {
graph.alpha = FlxMath.lerp(0,1,tween.percent);
graphSprite.alpha = FlxMath.lerp(0,1,tween.percent);
}});
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
super.create();
}
var frames = 0;
override function update(elapsed:Float)
{
if (music.volume < 0.5)
music.volume += 0.01 * elapsed;
// keybinds
if (FlxG.keys.justPressed.ENTER)
{
music.fadeOut(0.3);
PlayState.loadRep = false;
PlayState.rep = null;
if (PlayState.isStoryMode)
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
FlxG.switchState(new MainMenuState());
}
else
FlxG.switchState(new FreeplayState());
}
if (FlxG.keys.justPressed.EIGHT)
{
graph.showInput = !graph.showInput;
graph.update();
}
if (FlxG.keys.justPressed.F1)
{
trace(PlayState.rep.path);
PlayState.rep = Replay.LoadReplay(PlayState.rep.path);
PlayState.loadRep = true;
var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';
case 'Philly-Nice': songFormat = 'Philly';
// Replay v1.0 support
case 'dad-battle': songFormat = 'Dadbattle';
case 'philly-nice': songFormat = 'Philly';
}
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
music.fadeOut(0.3);
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
PlayState.storyWeek = 0;
LoadingState.loadAndSwitchState(new PlayState());
}
if (FlxG.keys.justPressed.F2 )
{
PlayState.rep = null;
PlayState.loadRep = false;
var songFormat = StringTools.replace(PlayState.SONG.song, " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';
case 'Philly-Nice': songFormat = 'Philly';
case 'dad-battle': songFormat = 'Dadbattle';
case 'philly-nice': songFormat = 'Philly';
}
var poop:String = Highscore.formatSong(songFormat, PlayState.storyDifficulty);
music.fadeOut(0.3);
PlayState.SONG = Song.loadFromJson(poop, PlayState.SONG.song);
PlayState.isStoryMode = false;
PlayState.storyDifficulty = PlayState.storyDifficulty;
PlayState.storyWeek = 0;
LoadingState.loadAndSwitchState(new PlayState());
}
super.update(elapsed);
}
}

31
source - Copy/Section.hx Normal file
View File

@ -0,0 +1,31 @@
package;
typedef SwagSection =
{
var sectionNotes:Array<Dynamic>;
var lengthInSteps:Int;
var typeOfSection:Int;
var mustHitSection:Bool;
var bpm:Float;
var changeBPM:Bool;
var altAnim:Bool;
}
class Section
{
public var sectionNotes:Array<Dynamic> = [];
public var lengthInSteps:Int = 16;
public var typeOfSection:Int = 0;
public var mustHitSection:Bool = true;
/**
* Copies the first section into the second section!
*/
public static var COPYCAT:Int = 0;
public function new(lengthInSteps:Int = 16)
{
this.lengthInSteps = lengthInSteps;
}
}

1288
source - Copy/Snd.hx Normal file

File diff suppressed because it is too large Load Diff

332
source - Copy/SndTV.hx Normal file
View File

@ -0,0 +1,332 @@
import h2d.Tweenie.TType;
//praise delahee, i'll figure out what this shit means later!
enum TVVar{
TVVVolume;
TVVPan;
}
@:publicFields
class TweenV {
static var GUID = 0;
var uid = 0;
var man : SndTV;
var parent : Snd;
var n : Float;
var ln : Float;
var speed : Float;
var from : Float;
var to : Float;
var type : TType;
var plays : Int; // -1 = infini, 1 et plus = nombre d'exécutions (1 par défaut)
var varType : TVVar;
var onUpdate : Null<TweenV->Void>;
var onEnd : Null<TweenV->Void>;
var isDebug = false;
public inline function new (
parent:Snd ,
n:Float ,
ln:Float ,
varType:TVVar,
speed:Float ,
from:Float ,
to:Float ,
type:h2d.Tweenie.TType ,
plays ,
onUpdate ,
onEnd
) {
this.parent = parent ;
this.n = n ;
this.ln = ln ;
this.varType = varType ;
this.speed = speed ;
this.from = from ;
this.to = to ;
this.type = type ;
this.plays = plays ;
this.onUpdate = onUpdate ;
this.onEnd = onEnd ;
}
public inline function reset(
parent:Snd ,
n:Float ,
ln:Float ,
varType:TVVar,
speed:Float ,
from:Float ,
to:Float ,
type:TType ,
plays:Int ,
onUpdate ,
onEnd
) {
this.parent = parent ;
this.n = n ;
this.ln = ln ;
this.speed = speed ;
this.from = from ;
this.to = to ;
this.type = type ;
this.plays = plays ;
this.onUpdate = onUpdate ;
this.onEnd = onEnd ;
this.varType = varType ;
isDebug = false;
uid = GUID++;
}
public function clear(){
n = 0.0;
ln = 0.0;
speed = 0.0;
plays = 0;
from = 0.0;
to = 0.0;
parent = null;
onEnd = null;
onUpdate = null;
isDebug = false;
uid = GUID++;
}
public
inline
function apply( val ) {
switch(varType){
case TVVVolume: {
parent.volume = val;
#if debug
if( isDebug )
trace("tv:" + val);
#end
}
case TVVPan: parent.pan = val;
}
}
public inline function kill( withCbk = true ) {
if ( withCbk )
man.terminateTween( this );
else
man.forceTerminateTween( this) ;
}
}
/**
* tween order is not respected
*/
class SndTV {
static var DEFAULT_DURATION = DateTools.seconds(1);
public var fps = 60.0;
public var isDebug = false;
var tlist : hxd.Stack<TweenV>;
public function new() {
tlist = new hxd.Stack<TweenV>();
tlist.reserve(8);
}
function onError(e) {
trace(e);
}
public function count() {
return tlist.length;
}
public inline function create(parent:Snd, vartype:TVVar, to:Float, ?tp:h2d.Tweenie.TType, ?duration_ms:Float) : TweenV{
return create_(parent, vartype, to, tp, duration_ms);
}
public function exists(p:Snd) {
for (t in tlist)
if (t.parent == p )
return true;
return false;
}
public var pool : hxd.Stack<TweenV> = new hxd.Stack();
function create_(p:Snd, vartype:TVVar,to:Float, ?tp:h2d.Tweenie.TType, ?duration_ms:Float) : TweenV{
if ( duration_ms==null )
duration_ms = DEFAULT_DURATION;
#if debug
if ( p == null ) trace("tween2 creation failed to:"+to+" tp:"+tp);
#end
if ( tp==null ) tp = TEase;
{
// on supprime les tweens précédents appliqués à la même variable
for(t in tlist.backWardIterator())
if(t.parent==p && t.varType == vartype) {
forceTerminateTween(t);
}
}
var from = switch( vartype ){
case TVVVolume : p.volume;
case TVVPan : p.pan;
}
var t : TweenV;
if (pool.length == 0){
t = new TweenV(
p,
0.0,
0.0,
vartype,
1 / ( duration_ms*fps/1000 ), // une seconde
from,
to,
tp,
1,
null,
null
);
}
else {
t = pool.pop();
t.reset(
p,
0.0,
0.0,
vartype,
1 / ( duration_ms*fps/1000 ), // une seconde
from,
to,
tp,
1,
null,
null
);
}
if( t.from==t.to )
t.ln = 1; // tweening inutile : mais on s'assure ainsi qu'un update() et un end() seront bien appelés
t.man = this;
tlist.push(t);
return t;
}
public static inline
function fastPow2(n:Float):Float {
return n*n;
}
public static inline
function fastPow3(n:Float):Float {
return n*n*n;
}
public static inline
function bezier(t:Float, p0:Float, p1:Float,p2:Float, p3:Float) {
return
fastPow3(1-t)*p0 +
3*( t*fastPow2(1-t)*p1 + fastPow2(t)*(1-t)*p2 ) +
fastPow3(t)*p3;
}
// suppression du tween sans aucun appel aux callbacks onUpdate, onUpdateT et onEnd (!)
public function killWithoutCallbacks(parent:Snd) {
for (t in tlist.backWardIterator())
if (t.parent==parent ){
forceTerminateTween(t);
return true;
}
return false;
}
public function terminate(parent:Snd) {
for (t in tlist.backWardIterator())
if (t.parent==parent){
forceTerminateTween(t);
}
}
public function forceTerminateTween(t:TweenV) {
var tOk = tlist.remove(t);
if( tOk ){
t.clear();
pool.push(t);
}
}
public function terminateTween(t:TweenV, ?fl_allowLoop=false) {
var v = t.from + (t.to - t.from) * h2d.Tweenie.interp(t.type, 1);
t.apply(v);
onUpdate(t, 1);
var ouid = t.uid;
onEnd(t);
if( ouid == t.uid ){
if( fl_allowLoop && (t.plays==-1 || t.plays>1) ) {
if( t.plays!=-1 )
t.plays--;
t.n = t.ln = 0;
}
else {
forceTerminateTween(t);
}
}
}
public function terminateAll() {
for(t in tlist)
t.ln = 1;
update();
}
inline
function onUpdate(t:TweenV, n:Float) {
if ( t.onUpdate!=null )
t.onUpdate(t);
}
inline
function onEnd(t:TweenV) {
if ( t.onEnd!=null )
t.onEnd(t);
}
public function update(?tmod = 1.0) {
if ( tlist.length > 0 ) {
for (t in tlist.backWardIterator() ) {
var dist = t.to-t.from;
if (t.type==TRand)
t.ln+=if(Std.random(100)<33) t.speed * tmod else 0;
else
t.ln += t.speed * tmod;
t.n = h2d.Tweenie.interp(t.type, t.ln);
if ( t.ln<1 ) {
// en cours...
var val = t.from + t.n*dist;
t.apply(val);
onUpdate(t, t.ln);
}
else // fini !
{
terminateTween(t, true);
}
}
}
}
}

93
source - Copy/Song.hx Normal file
View File

@ -0,0 +1,93 @@
package;
import Section.SwagSection;
import haxe.Json;
import haxe.format.JsonParser;
import lime.utils.Assets;
using StringTools;
typedef SwagSong =
{
var song:String;
var notes:Array<SwagSection>;
var bpm:Float;
var needsVoices:Bool;
var speed:Float;
var player1:String;
var player2:String;
var gfVersion:String;
var noteStyle:String;
var stage:String;
var validScore:Bool;
}
class Song
{
public var song:String;
public var notes:Array<SwagSection>;
public var bpm:Float;
public var needsVoices:Bool = true;
public var speed:Float = 1;
public var player1:String = 'bf';
public var player2:String = 'dad';
public var gfVersion:String = '';
public var noteStyle:String = '';
public var stage:String = '';
public function new(song, notes, bpm)
{
this.song = song;
this.notes = notes;
this.bpm = bpm;
}
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
{
trace(jsonInput);
// pre lowercasing the folder name
var folderLowercase = StringTools.replace(folder, " ", "-").toLowerCase();
switch (folderLowercase) {
case 'dad-battle': folderLowercase = 'dadbattle';
case 'philly-nice': folderLowercase = 'philly';
}
trace('loading ' + folderLowercase + '/' + jsonInput.toLowerCase());
var rawJson = Assets.getText(Paths.json(folderLowercase + '/' + jsonInput.toLowerCase())).trim();
while (!rawJson.endsWith("}"))
{
rawJson = rawJson.substr(0, rawJson.length - 1);
// LOL GOING THROUGH THE BULLSHIT TO CLEAN IDK WHATS STRANGE
}
// FIX THE CASTING ON WINDOWS/NATIVE
// Windows???
// trace(songData);
// trace('LOADED FROM JSON: ' + songData.notes);
/*
for (i in 0...songData.notes.length)
{
trace('LOADED FROM JSON: ' + songData.notes[i].sectionNotes);
// songData.notes[i].sectionNotes = songData.notes[i].sectionNotes
}
daNotes = songData.notes;
daSong = songData.song;
daBpm = songData.bpm; */
return parseJSONshit(rawJson);
}
public static function parseJSONshit(rawJson:String):SwagSong
{
var swagShit:SwagSong = cast Json.parse(rawJson).song;
swagShit.validScore = true;
return swagShit;
}
}

View File

@ -0,0 +1,403 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxGroup;
import flixel.math.FlxMath;
import flixel.text.FlxText;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import lime.net.curl.CURLCode;
#if windows
import Discord.DiscordClient;
#end
using StringTools;
class StoryMenuState extends MusicBeatState
{
var scoreText:FlxText;
var weekData:Array<Dynamic> = [
['Tutorial'],
['Bopeebo', 'Fresh', 'Dad Battle'],
['Spookeez', 'South', "Monster"],
['Pico', 'Philly Nice', "Blammed"],
['Satin Panties', "High", "Milf"],
['Cocoa', 'Eggnog', 'Winter Horrorland'],
['Senpai', 'Roses', 'Thorns']
];
var curDifficulty:Int = 1;
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true];
var weekCharacters:Array<Dynamic> = [
['', 'bf', 'gf'],
['dad', 'bf', 'gf'],
['spooky', 'bf', 'gf'],
['pico', 'bf', 'gf'],
['mom', 'bf', 'gf'],
['parents-christmas', 'bf', 'gf'],
['senpai', 'bf', 'gf']
];
var weekNames:Array<String> = [
"",
"Daddy Dearest",
"Spooky Month",
"PICO",
"MOMMY MUST MURDER",
"RED SNOW",
"Hating Simulator ft. Moawling"
];
var txtWeekTitle:FlxText;
var curWeek:Int = 0;
var txtTracklist:FlxText;
var grpWeekText:FlxTypedGroup<MenuItem>;
var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
var grpLocks:FlxTypedGroup<FlxSprite>;
var difficultySelectors:FlxGroup;
var sprDifficulty:FlxSprite;
var leftArrow:FlxSprite;
var rightArrow:FlxSprite;
override function create()
{
#if windows
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Story Mode Menu", null);
#end
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
if (FlxG.sound.music != null)
{
if (!FlxG.sound.music.playing)
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}
persistentUpdate = persistentDraw = true;
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
scoreText.setFormat("VCR OSD Mono", 32);
txtWeekTitle = new FlxText(FlxG.width * 0.7, 10, 0, "", 32);
txtWeekTitle.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, RIGHT);
txtWeekTitle.alpha = 0.7;
var rankText:FlxText = new FlxText(0, 10);
rankText.text = 'RANK: GREAT';
rankText.setFormat(Paths.font("vcr.ttf"), 32);
rankText.size = scoreText.size;
rankText.screenCenter(X);
var ui_tex = Paths.getSparrowAtlas('campaign_menu_UI_assets');
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
grpWeekText = new FlxTypedGroup<MenuItem>();
add(grpWeekText);
var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK);
add(blackBarThingie);
grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
grpLocks = new FlxTypedGroup<FlxSprite>();
add(grpLocks);
trace("Line 70");
for (i in 0...weekData.length)
{
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
weekThing.y += ((weekThing.height + 20) * i);
weekThing.targetY = i;
grpWeekText.add(weekThing);
weekThing.screenCenter(X);
weekThing.antialiasing = true;
// weekThing.updateHitbox();
// Needs an offset thingie
if (!weekUnlocked[i])
{
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
lock.frames = ui_tex;
lock.animation.addByPrefix('lock', 'lock');
lock.animation.play('lock');
lock.ID = i;
lock.antialiasing = true;
grpLocks.add(lock);
}
}
trace("Line 96");
grpWeekCharacters.add(new MenuCharacter(0, 100, 0.5, false));
grpWeekCharacters.add(new MenuCharacter(450, 25, 0.9, true));
grpWeekCharacters.add(new MenuCharacter(850, 100, 0.5, true));
difficultySelectors = new FlxGroup();
add(difficultySelectors);
trace("Line 124");
leftArrow = new FlxSprite(grpWeekText.members[0].x + grpWeekText.members[0].width + 10, grpWeekText.members[0].y + 10);
leftArrow.frames = ui_tex;
leftArrow.animation.addByPrefix('idle', "arrow left");
leftArrow.animation.addByPrefix('press', "arrow push left");
leftArrow.animation.play('idle');
difficultySelectors.add(leftArrow);
sprDifficulty = new FlxSprite(leftArrow.x + 130, leftArrow.y);
sprDifficulty.frames = ui_tex;
sprDifficulty.animation.addByPrefix('easy', 'EASY');
sprDifficulty.animation.addByPrefix('normal', 'NORMAL');
sprDifficulty.animation.addByPrefix('hard', 'HARD');
sprDifficulty.animation.play('easy');
changeDifficulty();
difficultySelectors.add(sprDifficulty);
rightArrow = new FlxSprite(sprDifficulty.x + sprDifficulty.width + 50, leftArrow.y);
rightArrow.frames = ui_tex;
rightArrow.animation.addByPrefix('idle', 'arrow right');
rightArrow.animation.addByPrefix('press', "arrow push right", 24, false);
rightArrow.animation.play('idle');
difficultySelectors.add(rightArrow);
trace("Line 150");
add(yellowBG);
add(grpWeekCharacters);
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
txtTracklist.alignment = CENTER;
txtTracklist.font = rankText.font;
txtTracklist.color = 0xFFe55777;
add(txtTracklist);
// add(rankText);
add(scoreText);
add(txtWeekTitle);
updateText();
trace("Line 165");
super.create();
}
override function update(elapsed:Float)
{
// scoreText.setFormat('VCR OSD Mono', 32);
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.5));
scoreText.text = "WEEK SCORE:" + lerpScore;
txtWeekTitle.text = weekNames[curWeek].toUpperCase();
txtWeekTitle.x = FlxG.width - (txtWeekTitle.width + 10);
// FlxG.watch.addQuick('font', scoreText.font);
difficultySelectors.visible = weekUnlocked[curWeek];
grpLocks.forEach(function(lock:FlxSprite)
{
lock.y = grpWeekText.members[lock.ID].y;
});
if (!movedBack)
{
if (!selectedWeek)
{
if (controls.UP_P)
{
changeWeek(-1);
}
if (controls.DOWN_P)
{
changeWeek(1);
}
if (controls.RIGHT)
rightArrow.animation.play('press')
else
rightArrow.animation.play('idle');
if (controls.LEFT)
leftArrow.animation.play('press');
else
leftArrow.animation.play('idle');
if (controls.RIGHT_P)
changeDifficulty(1);
if (controls.LEFT_P)
changeDifficulty(-1);
}
if (controls.ACCEPT)
{
selectWeek();
}
}
if (controls.BACK && !movedBack && !selectedWeek)
{
FlxG.sound.play(Paths.sound('cancelMenu'));
movedBack = true;
FlxG.switchState(new MainMenuState());
}
super.update(elapsed);
}
var movedBack:Bool = false;
var selectedWeek:Bool = false;
var stopspamming:Bool = false;
function selectWeek()
{
if (weekUnlocked[curWeek])
{
if (stopspamming == false)
{
FlxG.sound.play(Paths.sound('confirmMenu'));
grpWeekText.members[curWeek].startFlashing();
grpWeekCharacters.members[1].animation.play('bfConfirm');
stopspamming = true;
}
PlayState.storyPlaylist = weekData[curWeek];
PlayState.isStoryMode = true;
selectedWeek = true;
PlayState.storyDifficulty = curDifficulty;
// adjusting the song name to be compatible
var songFormat = StringTools.replace(PlayState.storyPlaylist[0], " ", "-");
switch (songFormat) {
case 'Dad-Battle': songFormat = 'Dadbattle';
case 'Philly-Nice': songFormat = 'Philly';
}
var poop:String = Highscore.formatSong(songFormat, curDifficulty);
PlayState.sicks = 0;
PlayState.bads = 0;
PlayState.shits = 0;
PlayState.goods = 0;
PlayState.campaignMisses = 0;
PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]);
PlayState.storyWeek = curWeek;
PlayState.campaignScore = 0;
new FlxTimer().start(1, function(tmr:FlxTimer)
{
LoadingState.loadAndSwitchState(new PlayState(), true);
});
}
}
function changeDifficulty(change:Int = 0):Void
{
curDifficulty += change;
if (curDifficulty < 0)
curDifficulty = 2;
if (curDifficulty > 2)
curDifficulty = 0;
sprDifficulty.offset.x = 0;
switch (curDifficulty)
{
case 0:
sprDifficulty.animation.play('easy');
sprDifficulty.offset.x = 20;
case 1:
sprDifficulty.animation.play('normal');
sprDifficulty.offset.x = 70;
case 2:
sprDifficulty.animation.play('hard');
sprDifficulty.offset.x = 20;
}
sprDifficulty.alpha = 0;
// USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP
sprDifficulty.y = leftArrow.y - 15;
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
#if !switch
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
#end
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
}
var lerpScore:Int = 0;
var intendedScore:Int = 0;
function changeWeek(change:Int = 0):Void
{
curWeek += change;
if (curWeek >= weekData.length)
curWeek = 0;
if (curWeek < 0)
curWeek = weekData.length - 1;
var bullShit:Int = 0;
for (item in grpWeekText.members)
{
item.targetY = bullShit - curWeek;
if (item.targetY == Std.int(0) && weekUnlocked[curWeek])
item.alpha = 1;
else
item.alpha = 0.6;
bullShit++;
}
FlxG.sound.play(Paths.sound('scrollMenu'));
updateText();
}
function updateText()
{
grpWeekCharacters.members[0].setCharacter(weekCharacters[curWeek][0]);
grpWeekCharacters.members[1].setCharacter(weekCharacters[curWeek][1]);
grpWeekCharacters.members[2].setCharacter(weekCharacters[curWeek][2]);
txtTracklist.text = "Tracks\n";
var stringThing:Array<String> = weekData[curWeek];
for (i in stringThing)
txtTracklist.text += "\n" + i;
txtTracklist.text = txtTracklist.text.toUpperCase();
txtTracklist.screenCenter(X);
txtTracklist.x -= FlxG.width * 0.35;
txtTracklist.text += "\n";
#if !switch
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
#end
}
}

479
source - Copy/TitleState.hx Normal file
View File

@ -0,0 +1,479 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup;
import flixel.input.gamepad.FlxGamepad;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxSound;
import flixel.system.ui.FlxSoundTray;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import io.newgrounds.NG;
import lime.app.Application;
import openfl.Assets;
#if windows
import Discord.DiscordClient;
#end
#if cpp
import sys.thread.Thread;
#end
using StringTools;
class TitleState extends MusicBeatState
{
static var initialized:Bool = false;
var blackScreen:FlxSprite;
var credGroup:FlxGroup;
var credTextShit:Alphabet;
var textGroup:FlxGroup;
var ngSpr:FlxSprite;
var curWacky:Array<String> = [];
var wackyImage:FlxSprite;
override public function create():Void
{
#if polymod
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
#end
#if sys
if (!sys.FileSystem.exists(Sys.getCwd() + "/assets/replays"))
sys.FileSystem.createDirectory(Sys.getCwd() + "/assets/replays");
#end
@:privateAccess
{
trace("Loaded " + openfl.Assets.getLibrary("default").assetsLoaded + " assets (DEFAULT)");
}
PlayerSettings.init();
#if windows
DiscordClient.initialize();
Application.current.onExit.add (function (exitCode) {
DiscordClient.shutdown();
});
#end
curWacky = FlxG.random.getObject(getIntroTextShit());
// DEBUG BULLSHIT
super.create();
// NGio.noLogin(APIStuff.API);
#if ng
var ng:NGio = new NGio(APIStuff.API, APIStuff.EncKey);
trace('NEWGROUNDS LOL');
#end
FlxG.save.bind('funkin', 'ninjamuffin99');
KadeEngineData.initSave();
Highscore.load();
if (FlxG.save.data.weekUnlocked != null)
{
// FIX LATER!!!
// WEEK UNLOCK PROGRESSION!!
// StoryMenuState.weekUnlocked = FlxG.save.data.weekUnlocked;
if (StoryMenuState.weekUnlocked.length < 4)
StoryMenuState.weekUnlocked.insert(0, true);
// QUICK PATCH OOPS!
if (!StoryMenuState.weekUnlocked[0])
StoryMenuState.weekUnlocked[0] = true;
}
#if FREEPLAY
FlxG.switchState(new FreeplayState());
#elseif CHARTING
FlxG.switchState(new ChartingState());
#else
new FlxTimer().start(1, function(tmr:FlxTimer)
{
startIntro();
});
#end
}
var logoBl:FlxSprite;
var gfDance:FlxSprite;
var danceLeft:Bool = false;
var titleText:FlxSprite;
function startIntro()
{
if (!initialized)
{
var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
diamond.persist = true;
diamond.destroyOnNoUse = false;
FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32},
new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1),
{asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
// HAD TO MODIFY SOME BACKEND SHIT
// IF THIS PR IS HERE IF ITS ACCEPTED UR GOOD TO GO
// https://github.com/HaxeFlixel/flixel-addons/pull/348
// var music:FlxSound = new FlxSound();
// music.loadStream(Paths.music('freakyMenu'));
// FlxG.sound.list.add(music);
// music.play();
FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxG.sound.music.fadeIn(4, 0, 0.7);
}
Conductor.changeBPM(102);
persistentUpdate = true;
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
// bg.antialiasing = true;
// bg.setGraphicSize(Std.int(bg.width * 0.6));
// bg.updateHitbox();
add(bg);
if(Main.watermarks) {
logoBl = new FlxSprite(-150, -100);
logoBl.frames = Paths.getSparrowAtlas('KadeEngineLogoBumpin');
logoBl.antialiasing = true;
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
logoBl.animation.play('bump');
logoBl.updateHitbox();
// logoBl.screenCenter();
// logoBl.color = FlxColor.BLACK;
} else {
logoBl = new FlxSprite(-150, -100);
logoBl.frames = Paths.getSparrowAtlas('logoBumpin');
logoBl.antialiasing = true;
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
logoBl.animation.play('bump');
logoBl.updateHitbox();
// logoBl.screenCenter();
// logoBl.color = FlxColor.BLACK;
}
gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07);
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
gfDance.antialiasing = true;
add(gfDance);
add(logoBl);
titleText = new FlxSprite(100, FlxG.height * 0.8);
titleText.frames = Paths.getSparrowAtlas('titleEnter');
titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24);
titleText.animation.addByPrefix('press', "ENTER PRESSED", 24);
titleText.antialiasing = true;
titleText.animation.play('idle');
titleText.updateHitbox();
// titleText.screenCenter(X);
add(titleText);
var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo'));
logo.screenCenter();
logo.antialiasing = true;
// add(logo);
// FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
// FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
credGroup = new FlxGroup();
add(credGroup);
textGroup = new FlxGroup();
blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
credGroup.add(blackScreen);
credTextShit = new Alphabet(0, 0, "ninjamuffin99\nPhantomArcade\nkawaisprite\nevilsk8er", true);
credTextShit.screenCenter();
// credTextShit.alignment = CENTER;
credTextShit.visible = false;
ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadGraphic(Paths.image('newgrounds_logo'));
add(ngSpr);
ngSpr.visible = false;
ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8));
ngSpr.updateHitbox();
ngSpr.screenCenter(X);
ngSpr.antialiasing = true;
FlxTween.tween(credTextShit, {y: credTextShit.y + 20}, 2.9, {ease: FlxEase.quadInOut, type: PINGPONG});
FlxG.mouse.visible = false;
if (initialized)
skipIntro();
else
initialized = true;
// credGroup.add(credTextShit);
}
function getIntroTextShit():Array<Array<String>>
{
var fullText:String = Assets.getText(Paths.txt('introText'));
var firstArray:Array<String> = fullText.split('\n');
var swagGoodArray:Array<Array<String>> = [];
for (i in firstArray)
{
swagGoodArray.push(i.split('--'));
}
return swagGoodArray;
}
var transitioning:Bool = false;
override function update(elapsed:Float)
{
if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time;
// FlxG.watch.addQuick('amp', FlxG.sound.music.amplitude);
if (FlxG.keys.justPressed.F)
{
FlxG.fullscreen = !FlxG.fullscreen;
}
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
#if mobile
for (touch in FlxG.touches.list)
{
if (touch.justPressed)
{
pressedEnter = true;
}
}
#end
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.START)
pressedEnter = true;
#if switch
if (gamepad.justPressed.B)
pressedEnter = true;
#end
}
if (pressedEnter && !transitioning && skippedIntro)
{
#if !switch
NGio.unlockMedal(60960);
// If it's Friday according to da clock
if (Date.now().getDay() == 5)
NGio.unlockMedal(61034);
#end
if (FlxG.save.data.flashing)
titleText.animation.play('press');
FlxG.camera.flash(FlxColor.WHITE, 1);
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
transitioning = true;
// FlxG.sound.music.stop();
MainMenuState.firstStart = true;
new FlxTimer().start(2, function(tmr:FlxTimer)
{
// Get current version of Kade Engine
var http = new haxe.Http("https://raw.githubusercontent.com/KadeDev/Kade-Engine/master/version.downloadMe");
var returnedData:Array<String> = [];
http.onData = function (data:String)
{
returnedData[0] = data.substring(0, data.indexOf(';'));
returnedData[1] = data.substring(data.indexOf('-'), data.length);
if (!MainMenuState.kadeEngineVer.contains(returnedData[0].trim()) && !OutdatedSubState.leftState && MainMenuState.nightly == "")
{
trace('outdated lmao! ' + returnedData[0] + ' != ' + MainMenuState.kadeEngineVer);
OutdatedSubState.needVer = returnedData[0];
OutdatedSubState.currChanges = returnedData[1];
FlxG.switchState(new OutdatedSubState());
}
else
{
FlxG.switchState(new MainMenuState());
}
}
http.onError = function (error) {
trace('error: $error');
FlxG.switchState(new MainMenuState()); // fail but we go anyway
}
http.request();
});
// FlxG.sound.play(Paths.music('titleShoot'), 0.7);
}
if (pressedEnter && !skippedIntro && initialized)
{
skipIntro();
}
super.update(elapsed);
}
function createCoolText(textArray:Array<String>)
{
for (i in 0...textArray.length)
{
var money:Alphabet = new Alphabet(0, 0, textArray[i], true, false);
money.screenCenter(X);
money.y += (i * 60) + 200;
credGroup.add(money);
textGroup.add(money);
}
}
function addMoreText(text:String)
{
var coolText:Alphabet = new Alphabet(0, 0, text, true, false);
coolText.screenCenter(X);
coolText.y += (textGroup.length * 60) + 200;
credGroup.add(coolText);
textGroup.add(coolText);
}
function deleteCoolText()
{
while (textGroup.members.length > 0)
{
credGroup.remove(textGroup.members[0], true);
textGroup.remove(textGroup.members[0], true);
}
}
override function beatHit()
{
super.beatHit();
logoBl.animation.play('bump');
danceLeft = !danceLeft;
if (danceLeft)
gfDance.animation.play('danceRight');
else
gfDance.animation.play('danceLeft');
FlxG.log.add(curBeat);
switch (curBeat)
{
case 1:
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
// credTextShit.visible = true;
case 3:
addMoreText('present');
// credTextShit.text += '\npresent...';
// credTextShit.addText();
case 4:
deleteCoolText();
// credTextShit.visible = false;
// credTextShit.text = 'In association \nwith';
// credTextShit.screenCenter();
case 5:
if (Main.watermarks)
createCoolText(['Kade Engine', 'by']);
else
createCoolText(['In Partnership', 'with']);
case 7:
if (Main.watermarks)
addMoreText('KadeDeveloper');
else
{
addMoreText('Newgrounds');
ngSpr.visible = true;
}
// credTextShit.text += '\nNewgrounds';
case 8:
deleteCoolText();
ngSpr.visible = false;
// credTextShit.visible = false;
// credTextShit.text = 'Shoutouts Tom Fulp';
// credTextShit.screenCenter();
case 9:
createCoolText([curWacky[0]]);
// credTextShit.visible = true;
case 11:
addMoreText(curWacky[1]);
// credTextShit.text += '\nlmao';
case 12:
deleteCoolText();
// credTextShit.visible = false;
// credTextShit.text = "Friday";
// credTextShit.screenCenter();
case 13:
addMoreText('Friday');
// credTextShit.visible = true;
case 14:
addMoreText('Night');
// credTextShit.text += '\nNight';
case 15:
addMoreText('Funkin'); // credTextShit.text += '\nFunkin';
case 16:
skipIntro();
}
}
var skippedIntro:Bool = false;
function skipIntro():Void
{
if (!skippedIntro)
{
remove(ngSpr);
FlxG.camera.flash(FlxColor.WHITE, 4);
remove(credGroup);
skippedIntro = true;
}
}
}

Some files were not shown because too many files have changed in this diff Show More