Skip to content

Commit

Permalink
Added Kindergarten gameplay, epic dialogues, improved the shitty appl…
Browse files Browse the repository at this point in the history
…es code, etc.

Added Kindergarten gameplay, epic dialogues, improved the shitty apples code, etc.
  • Loading branch information
TheGaloXx committed Dec 2, 2022
1 parent 34e502a commit 96be893
Show file tree
Hide file tree
Showing 26 changed files with 1,708 additions and 159 deletions.
4 changes: 2 additions & 2 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
<assets path='extra/art' rename='icons' />
<assets path="assets/fonts" embed='true' if="windows"/>

<haxelib name="flixel" />
<haxelib name="flixel" version="4.11.0"/> <!--<fucking FlxG.save.data broken, I updated to flixel 5.0.1 but it changes some things, so to not make too much trouble i'll just keep with 4.11.0-->
<!--<haxelib name="flixel"/>-->
<haxelib name="flixel-addons" />
<haxelib name="flixel-studio"/>
<haxelib name="flixel-ui" />
<haxelib name="linc_luajit" if="windows"/>
<haxelib name="hxCodec" if="desktop" />
<haxelib name="flixel-shadertoy-shader" />

<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />
<haxedef name="FLX_NO_DEBUG" unless="debug" />
Expand Down
Binary file added assets/preload/images/world/backyard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/preload/images/world/indicator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/preload/images/world/kids.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions assets/preload/images/world/kids.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="kids.png">
<!-- Created with Adobe Animate version 21.0.7.42652 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="bf0000" x="0" y="0" width="124" height="170" frameX="-1" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0001" x="124" y="0" width="124" height="169" frameX="-1" frameY="-1" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0002" x="248" y="0" width="125" height="168" frameX="0" frameY="-2" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0003" x="373" y="0" width="125" height="166" frameX="0" frameY="-4" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0004" x="498" y="0" width="125" height="165" frameX="0" frameY="-5" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0005" x="623" y="0" width="125" height="166" frameX="0" frameY="-4" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0006" x="748" y="0" width="125" height="168" frameX="0" frameY="-2" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0007" x="873" y="0" width="124" height="169" frameX="-1" frameY="-1" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0008" x="0" y="0" width="124" height="170" frameX="-1" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0009" x="0" y="170" width="125" height="169" frameX="-1" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0010" x="125" y="170" width="124" height="169" frameX="-2" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0011" x="249" y="170" width="125" height="169" frameX="-2" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0012" x="374" y="170" width="124" height="169" frameX="-3" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0013" x="498" y="170" width="126" height="169" frameX="-1" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0014" x="624" y="170" width="124" height="169" frameX="-2" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0015" x="748" y="170" width="125" height="169" frameX="-1" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="bf0016" x="873" y="170" width="124" height="169" frameX="-1" frameY="0" frameWidth="127" frameHeight="170"/>
<SubTexture name="protagonist0000" x="0" y="339" width="90" height="155"/>
<SubTexture name="protagonist0001" x="90" y="339" width="89" height="154" frameX="0" frameY="-1" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0002" x="179" y="339" width="88" height="153" frameX="0" frameY="-2" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0003" x="267" y="339" width="89" height="151" frameX="0" frameY="-4" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0004" x="356" y="339" width="89" height="150" frameX="0" frameY="-5" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0005" x="445" y="339" width="89" height="151" frameX="0" frameY="-4" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0006" x="534" y="339" width="88" height="153" frameX="0" frameY="-2" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0007" x="622" y="339" width="89" height="154" frameX="0" frameY="-1" frameWidth="90" frameHeight="155"/>
<SubTexture name="protagonist0008" x="0" y="339" width="90" height="155"/>
</TextureAtlas>
Binary file added assets/preload/images/world/room.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/preload/sounds/cancelMenu.ogg
Binary file not shown.
Binary file added assets/shared/images/gameplay/dialogue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/shared/images/gameplay/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/shared/images/gameplay/icons.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="icons.png">
<!-- Created with Adobe Animate version 21.0.7.42652 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="bf0000" x="0" y="0" width="128" height="112"/>
<SubTexture name="bf0001" x="128" y="0" width="128" height="112"/>
<SubTexture name="nugget0000" x="256" y="0" width="104" height="96"/>
<SubTexture name="nugget0001" x="360" y="0" width="104" height="96"/>
<SubTexture name="protagonist0000" x="0" y="112" width="88" height="96"/>
<SubTexture name="protagonist0001" x="88" y="112" width="88" height="96"/>
</TextureAtlas>
Binary file added assets/shared/sounds/text.ogg
Binary file not shown.
Binary file added extra/art/Flash files/Custom Boyfriend.fla
Binary file not shown.
Binary file added extra/art/Flash files/Dialogue Stuff.fla
Binary file not shown.
Binary file added extra/art/Flash files/World Characters.fla
Binary file not shown.
110 changes: 110 additions & 0 deletions source/BackyardState.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package;

import flixel.util.FlxColor;
import lime.app.Application;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxSprite;
import Kid;

class BackyardState extends MusicBeatState
{
var background:FlxSprite;
var water:FlxSprite;
var bf:KidBoyfriend;
var camara:FlxCamera;

var up:Bool = false;
var down:Bool = false;
var right:Bool = false;
var left:Bool = false;

var notPressedYet:Bool = true;

override public function create()
{
Application.current.window.title = (Main.appTitle + ' - Backyard');

#if debug
flixel.addons.studio.FlxStudio.create();
#end

background = new FlxSprite(0,0).loadGraphic(Paths.image('world/backyard'));
background.antialiasing = false;
background.flipY = true;
background.setGraphicSize(Std.int(background.width * 3), Std.int(background.height * 3));
background.updateHitbox();
background.screenCenter();
add(background);

bf = new KidBoyfriend(-90, 288);
bf.facing = RIGHT;
add(bf);

water = new FlxSprite().makeGraphic(100, 100, FlxColor.YELLOW);
water.alpha = 0;
water.width = 519;
water.height = 124;
water.setGraphicSize(519, 124);
water.updateHitbox();
water.setPosition(-138, 594);
water.immovable = true;
add(water);

camara = new FlxCamera(0, 0, FlxG.width, FlxG.height);
FlxG.cameras.reset(camara);
camara.target = bf;
//camara.setScrollBoundsRect(-128, 0, 1200 * 1.25, (480 * 1.5) + 15); this is already fine but i want to improve it
camara.setScrollBoundsRect(-128, 0, 1200 * 1.275, (480 * 1.5) + 20);
add(camara);

FlxCamera.defaultCameras = [camara];

super.create();
}

var transitioning:Bool = false;

override public function update(elapsed:Float)
{
if (FlxG.keys.justPressed.ANY && notPressedYet)
notPressedYet = false;

screenCollision();

if (bf.x < -100 && bf.y < 335 && !transitioning)
{
transitioning = true;
FlxG.switchState(new RoomState());
}

if (FlxG.keys.anyJustPressed([ESCAPE, BACKSPACE]))
{
bf.canMove = false;
FlxG.switchState(new menus.MainMenuState());
}

super.update(elapsed);
}

function screenCollision():Void
{
if (notPressedYet) //because bf appears on the bottom of the screen for some reason lol
return;

FlxG.collide(bf, water);

//95 285
if (bf.x < -128)
bf.x = -128;

if (bf.x > 1331)
bf.x = 1331;

if (bf.y < 264)
bf.y = 264;

if (bf.y > 642)
bf.y = 642;
}
}
41 changes: 41 additions & 0 deletions source/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,47 @@ class CoolUtil
}
return dumbArray;
}

public static function getDialogue():Array<String>
{
var dialogue:Array<String> = ['dad:a:false:false', 'bf:a:true:true'];
var song = PlayState.SONG.song;

if (FlxG.save.data.esp)
{
switch (song)
{
// character:dialogue:angry:yellow
// example: nugget:hi im nugget:*scream*:highlighted text
case 'DadBattle':
dialogue = ['dad: test test', 'bf: wait, this should work because there is no dad icon', 'dad: shut the fuck up'];
case 'Monday':
dialogue = ['dad: test test', 'bf: beep'];
case 'Nugget':
dialogue = ['nugget:AIHJSEDFIOAJSIOEDJFfedsfsfs', 'bf:Beep', 'protagonist:jaja xd lmao lol ñ', 'nugget:¡¡¡NO!!!:true'];
default:
trace('uh oh');
}
}
else
{
switch (song)
{
// character:dialogue:angry:yellow
// example: nugget:hi im nugget:*scream*:highlighted text
case 'DadBattle':
dialogue = ['protagonist:Normal text', 'protagonist:Angry text:true', 'protagonist:Hint text::true', 'protagonist:Angry hint text:true:true'];
case 'Monday':
dialogue = ['protagonist:I banged your mom.', 'bf: beep'];
case 'Nugget':
dialogue = ["nugget:Nugget's nuggets are as squishy as they are tasty.", 'bf:Beep bop', 'protagonist:*Throws the knife in the cave*', 'nugget:NUGGET SAID NO!!!:true'];
default:
trace('uh oh');
}
}

return dialogue;
}
}


176 changes: 176 additions & 0 deletions source/DialogueBox.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package;

import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import Objects.DialogueIcon;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.text.FlxTypeText;
import flixel.group.FlxSpriteGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;

using StringTools;

class DialogueBox extends FlxSpriteGroup
{
var box:FlxSprite; //box
var icon:DialogueIcon; //character icon
var swagDialogue:FlxTypeText; //dialogue text

var curCharacter:String = ''; //uhh character
var dialogueList:Array<String> = []; //dialogue
var angry:String = '';
var speed:Float;
var size:Int;
var yellow:String = '';

public var finishThing:Void->Void; //finishing function

var dialogueAppeared:Bool = false;
var dialogueStarted:Bool = false;
var isEnding:Bool = false;

public function new(dialogueList:Array<String>) //angry:bool for the bigger text
{
super();

trace("Creating DialogueBox");

this.dialogueList = dialogueList;

FlxG.sound.playMusic(Paths.music('freakyMenu', 'preload'), 0); //music that fades in
FlxG.sound.music.fadeIn(1, 0, 0.7);

box = new FlxSprite(0, 920).loadGraphic(Paths.image('gameplay/dialogue')); //box
box.antialiasing = FlxG.save.data.antialiasing;
box.scrollFactor.set();
box.screenCenter(X);
box.color = PlayState.dad.curColor;
add(box);

icon = new DialogueIcon(80, 960, PlayState.dad.curCharacter); //character icon
add(icon);

swagDialogue = new FlxTypeText(225, 560, Std.int(FlxG.width * 0.8), "", 64); //text
swagDialogue.font = Paths.font('Crayawn-v58y.ttf');
swagDialogue.color = FlxColor.BLACK;
swagDialogue.sounds = [FlxG.sound.load(Paths.sound('text'), 0.6)];
add(swagDialogue);

//things movement
FlxTween.tween(icon, {y: 560}, 0.5, {ease: FlxEase.sineInOut});
FlxTween.tween(box, {y: 520}, 0.5, {ease: FlxEase.sineOut, onComplete: function(_) dialogueAppeared = true });
trace("Finished creating DialogueBox");
}

override function update(elapsed:Float)
{
if (dialogueAppeared && !dialogueStarted) //dialogue appeared
{
startDialogue();
dialogueStarted = true;
}

if (FlxG.keys.anyJustPressed([ENTER, SPACE, BACKSPACE, ESCAPE]) && dialogueStarted == true)
{
FlxG.sound.play(Paths.sound('cancelMenu', 'preload'), 0.8);

if (dialogueList[1] == null && dialogueList[0] != null)
{
endDialogue();
}
else
{
dialogueList.remove(dialogueList[0]);
startDialogue();
}
}

super.update(elapsed);
}

function startDialogue():Void
{
cleanDialog();

box.color = icon.daColor;

if (icon.char != curCharacter)
{
remove(icon);
icon = new DialogueIcon(80, 560, curCharacter); //character icon
add(icon);
}

if (icon != null)
icon.animation.play('talking');

//if angry, faster and bigger text, if not angry, normal speed and size text
if (angry == 'true')
{speed = 0.03; size = 128; FlxG.cameras.shake(0.0075, 0.5);}
else if (angry != 'true')
{speed = 0.04; size = 64;}

if (yellow == 'true')
swagDialogue.color = FlxColor.YELLOW;
else
swagDialogue.color = FlxColor.BLACK;

swagDialogue.resetText(dialogueList[0]);
swagDialogue.size = size;
swagDialogue.start(speed, true, false, [], function() if (icon != null) icon.animation.play('idle'));
}

function cleanDialog():Void
{
var splitName:Array<String> = dialogueList[0].split(":");

curCharacter = splitName[0];
dialogueList[0] = splitName[1];
angry = splitName[2];
yellow = splitName[3];

if (angry != 'true' || angry == null || angry == '')
angry = 'false';
if (yellow != 'true' || yellow == null || yellow == '')
yellow = 'false';

trace("\n\nCharacter: " + splitName[0] + '\nDialogue: "' + splitName[1] + '"\nAngry: ' + splitName[2] + "\nYellow: " + splitName[3] + "\n\n" + ((dialogueList[1] == null && dialogueList[0] != null) ? "No more dialogues.\n\n" : "Next dialogue:\n"));

box.color = icon.daColor;

if (icon.char != curCharacter)
{
remove(icon);
icon = new DialogueIcon(80, 560, curCharacter); //character icon
add(icon);
}
}

function endDialogue():Void
{
if (!isEnding)
{
isEnding = true;

FlxG.sound.music.fadeOut(1.5, 0);

swagDialogue.kill();
swagDialogue.destroy();
FlxTween.tween(icon, {y: 960}, 0.5, {ease: FlxEase.sineOut});
FlxTween.tween(box, {y: 920}, 0.5, {ease: FlxEase.sineOut, onComplete: function(_)
{
finishThing();

box.kill();
box.destroy();
icon.kill();
icon.destroy();
kill();
destroy();
}});
}
}
}
Loading

0 comments on commit 96be893

Please sign in to comment.