Skip to content

Commit

Permalink
Fix me GuineaPig!
Browse files Browse the repository at this point in the history
  • Loading branch information
GuineaPigUuhh committed Feb 12, 2024
1 parent 9c5a5c9 commit 687d4e4
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 190 deletions.
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"openfl.lime-vscode-extension",
"redhat.vscode-xml"
]
}
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Build + Debug",
"type": "lime",
"request": "launch"
},
{
"name": "Debug",
"type": "lime",
"request": "launch",
"preLaunchTask": null
},
{
"name": "Macro",
"type": "haxe-eval",
"request": "launch"
}
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"search.exclude": {
"export/**/*.hx": true
},
"[haxe]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.codeActionsOnSave": {
"source.sortImports": true
}
},
"haxe.enableExtendedIndentation": true
}
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "lime",
"command": "test",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Binary file added assets/shared/images/fundo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/shared/images/gfDanceTitle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"starty":576,
"gfx":512,
"gfy":40,
"backgroundSprite":"",
"backgroundSprite":"fundo",
"bpm":102
}
Binary file modified assets/shared/images/titleEnter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions assets/shared/images/titleEnter.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="titleEnter.png">
<!-- Created with Adobe Animate version 21.0.2.37893 -->
<TextureAtlas imagePath="start_text.png">
<!-- Created with Adobe Animate version 22.0.8.217 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="ENTER FREEZE0000" x="8" y="8" width="1477" height="79"/>
<SubTexture name="ENTER IDLE0000" x="8" y="95" width="1477" height="79"/>
<SubTexture name="ENTER PRESSED0000" x="8" y="8" width="1477" height="79"/>
<SubTexture name="ENTER PRESSED0001" x="8" y="182" width="1477" height="79"/>
<SubTexture name="ENTER FREEZE0000" x="0" y="60" width="919" height="60"/>
<SubTexture name="ENTER IDLE0000" x="0" y="0" width="919" height="60"/>
<SubTexture name="ENTER PRESSED0000" x="0" y="60" width="919" height="60"/>
<SubTexture name="ENTER PRESSED0001" x="0" y="0" width="919" height="60"/>
</TextureAtlas>
179 changes: 90 additions & 89 deletions source/guineapiguuhh_stuff/MCButton.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,109 +3,110 @@ package guineapiguuhh_stuff;
import flixel.group.FlxSpriteGroup;
import flixel.util.FlxAxes;

@:enum abstract ButtonTypes(String) {
@:enum abstract ButtonTypes(String)
{
public var LARGE = "large";
public var MEDIUM = "medium";
public var SMALL = "small";
public var SQUARE = "square";
// Custom Types
public var YOUTUBE = "youtube";
public var SQUARE = "square";
// Custom Types
public var YOUTUBE = "youtube";
}

class MCButton extends FlxSpriteGroup
{
var text = "";
public var text = "";
public var clickSound = "click";

public var mcText:FlxText;
public var mcButton:FlxSprite;
public var mcText:FlxText;
public var mcButton:FlxSprite;

public var onClick = null;
public var disabled = false;
public var onClick = null;
public var disabled = false;

public static var default_size = 2.5;
public static var default_size = 2.5;

public function new(text:String, x:Float, y:Float, type:ButtonTypes)
{
super();
this.text = text;
public function new(text:String, x:Float, y:Float, type:ButtonTypes)
{
super();
this.text = text;

var graphicSizeX = 98;
if (type == MEDIUM)
graphicSizeX = 150;
else if (type == LARGE)
graphicSizeX = 200;
else if (type == SQUARE || type == YOUTUBE)
graphicSizeX = 20;
var graphicSizeX = 98;
if (type == MEDIUM)
graphicSizeX = 150;
else if (type == LARGE)
graphicSizeX = 200;
else if (type == SQUARE || type == YOUTUBE)
graphicSizeX = 20;

mcButton = new FlxSprite(x, y);
mcButton.loadGraphic(Paths.image("guineapiguuhh_stuff/ui/button_" + type), true, graphicSizeX, 20);
mcButton.animation.add("idle", [0], 0, false);
mcButton.animation.add("selected", [1], 0, false);
mcButton.animation.add("blank", [2], 0, false);
mcButton.scale.set(default_size, default_size);
mcButton.updateHitbox();
mcButton.animation.play("idle");
add(mcButton);
mcButton = new FlxSprite(x, y);
mcButton.loadGraphic(Paths.image("guineapiguuhh_stuff/ui/button_" + type), true, graphicSizeX, 20);
mcButton.animation.add("idle", [0], 0, false);
mcButton.animation.add("selected", [1], 0, false);
mcButton.animation.add("blank", [2], 0, false);
mcButton.scale.set(default_size, default_size);
mcButton.updateHitbox();
mcButton.animation.play("idle");
add(mcButton);

mcText = new FlxText(0, 0, mcButton.width, text);
mcText.setFormat(MCHelper.font, 20, FlxColor.WHITE, FlxTextAlign.CENTER);
mcText.setBorderStyle(FlxTextBorderStyle.SHADOW, 0xFF383838, 2, 1);
add(mcText);
}
mcText = new FlxText(0, 0, mcButton.width, text);
mcText.setFormat(MCHelper.font, 20, FlxColor.WHITE, FlxTextAlign.CENTER);
mcText.setBorderStyle(FlxTextBorderStyle.SHADOW, 0xFF383838, 2, 1);
mcText.updateHitbox();
add(mcText);
}

override function update(elapsed:Float)
{
super.update(elapsed);
if (disabled)
{
mcButton.animation.play("blank");
mcText.color = FlxColor.GRAY;
mcText.borderSize = 0;
}
else
{
mcButton.animation.play("idle");
mcText.color = FlxColor.WHITE;
mcText.borderSize = 2;
}
if (onClick != null && !disabled)
{
if (FlxG.mouse.overlaps(mcButton))
{
mcButton.animation.play("selected");
if (FlxG.mouse.justPressed)
{
onClick();
if (text == "Story mode")
FlxG.sound.play(Paths.sound('confirmMenu'));
else
FlxG.sound.play(Paths.sound('click'));
}
}
}
mcText.x = mcButton.x;
mcText.y = mcButton.y + 8;
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (disabled)
{
mcButton.animation.play("blank");
mcText.color = FlxColor.GRAY;
mcText.borderSize = 0;
}
else
{
mcButton.animation.play("idle");
mcText.color = FlxColor.WHITE;
mcText.borderSize = 2;
}
if (onClick != null && !disabled)
{
if (FlxG.mouse.overlaps(mcButton))
{
mcButton.animation.play("selected");
if (FlxG.mouse.justPressed)
{
onClick();
FlxG.sound.play(Paths.sound(clickSound));
}
}
}
mcText.x = mcButton.x;
mcText.y = mcButton.y + 8;
}

public function staticButton()
{
mcButton.scrollFactor.set(0,0);
mcText.scrollFactor.set(0,0);
}
public function staticButton()
{
mcButton.scrollFactor.set(0, 0);
mcText.scrollFactor.set(0, 0);
}

public function buttonScreenCenter(axes:FlxAxes = XY)
{
if (axes.x)
mcButton.screenCenter(X);
if (axes.y)
mcButton.screenCenter(Y);
return this;
}
public function buttonScreenCenter(axes:FlxAxes = XY)
{
if (axes.x)
mcButton.screenCenter(X);
if (axes.y)
mcButton.screenCenter(Y);
return this;
}

public function setButtonSize(x, y)
{
mcButton.scale.set(x, y);
mcButton.updateHitbox();
mcText.fieldWidth = mcButton.width;
mcText.fieldHeight = mcButton.height;
}
}
public function setButtonSize(x, y)
{
mcButton.scale.set(x, y);
mcButton.updateHitbox();
mcText.fieldWidth = mcButton.width;
mcText.fieldHeight = mcButton.height;
}
}
Loading

0 comments on commit 687d4e4

Please sign in to comment.