Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #67 from JokeBambi/bambipull
Browse files Browse the repository at this point in the history
Subtitles are Back
  • Loading branch information
moxie-coder authored Aug 8, 2023
2 parents 6e699c5 + ed48176 commit b042e99
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 3 deletions.
9 changes: 8 additions & 1 deletion assets/preload/locale/en-US/textList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ play_score==Score:
play_miss==Misses:
play_accuracy==Accuracy:

// Example Subtitles 1 //
example_sub1==dave's corn farm
example_sub2==where the corn is dave
example_sub3==sub to dave or he steal the corn
example_sub4==AAAAAAAAAAAAAAAAAA SHIT
example_sub5==u steal u noob

// Credits State //
credits_dev==Developers
credits_translator==Translators
Expand All @@ -126,4 +133,4 @@ credit_TheBuilderXD==Artist & Programmer for the original VS. Dave Mod
//translators
credit_dani==Spanish Translator
credit_Aizakku==Portguese-Brazillian Translator
credit_Soulegal==Portguese-Brazillian Translator
credit_Soulegal==Portguese-Brazillian Translator
11 changes: 10 additions & 1 deletion assets/preload/locale/es-US/textList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ play_score==Puntuación:
play_miss==Fallos:
play_accuracy==Precisión:

// Example Subtitles 1 //
example_sub1==granja de maíz de dave
example_sub2==donde el maíz es dave
example_sub3==sub a dave o él roba el maíz
example_sub4==AAAAAAAAAAAAAAAAAA MIERDA
example_sub5==u robar u noob

me when google translate funni!!! HAHWFHTRINYJHGBVIN

// Credits State //
credits_dev==Desarolladores
credits_translator==Traductores
Expand All @@ -125,4 +134,4 @@ credit_TheBuilderXD==Artista y Programador del mod original
//translators
credit_dani==Traductor al Español
credit_Aizakku==Traductor al Portugués
credit_Soulegal==Traductor al Portugués
credit_Soulegal==Traductor al Portugués
11 changes: 10 additions & 1 deletion assets/preload/locale/pt-br/textList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ play_score==Pontuação:
play_miss==Erros:
play_accuracy==Precisão:

// Example Subtitles 1 //
example_sub1==fazenda de milho de dave
example_sub2==onde o milho é dave
example_sub3==sub para dave ou ele roubar o milho
example_sub4==AAAAAAAAAAAAAAAAAA MERDA
example_sub5==u roubar u noob

google from translate guys (ok ok u can remove this line sorry i was joking around)

// Credits State //
credits_dev==Desenvolvedores
credits_translator==Tradutores
Expand All @@ -125,4 +134,4 @@ credit_TheBuilderXD==Artist e Programador do mod VS. Dave original
//translators
credit_dani==Tradutor (Espanhol)
credit_Aizakku==Tradutor (Português BR)
credit_Soulegal==Tradutor (Português BR)
credit_Soulegal==Tradutor (Português BR)
2 changes: 2 additions & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class PlayState extends MusicBeatState

public var backgroundSprites:FlxTypedGroup<FlxSprite> = new FlxTypedGroup<FlxSprite>();

public var subtitleManager:SubtitleManager;

var revertedBG:FlxTypedGroup<FlxSprite> = new FlxTypedGroup<FlxSprite>();

var possibleNotes:Array<Note> = [];
Expand Down
59 changes: 59 additions & 0 deletions source/Subtitle.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package;

import flixel.util.FlxAxes;
import flixel.system.FlxSound;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.addons.text.FlxTypeText;
import flixel.util.FlxTimer;
import flixel.FlxG;
import flixel.text.FlxText;

typedef SubtitleProperties = {
var ?x:Float;
var ?y:Float;
var ?subtitleSize:Int;
var ?typeSpeed:Float;
var ?screenCenter:FlxAxes;
}

class Subtitle extends FlxTypeText
{
public var manager:SubtitleManager;
public function new(text:String, ?typeSpeed, showTime:Float, properties:SubtitleProperties)
{
properties = init(properties);

super(properties.x, properties.y, FlxG.width, text, 36);
sounds = null;

setFormat("Comic Sans MS Bold", properties.subtitleSize, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
antialiasing = true;
borderSize = 2;

screenCenter(properties.screenCenter);

start(properties.typeSpeed, false, false, [], function()
{
new FlxTimer().start(showTime, function(timer:FlxTimer)
{
FlxTween.tween(this, {alpha: 0}, 0.5, {onComplete: function(tween:FlxTween)
{
manager.onSubtitleComplete(this);
}});
});
});
}
function init(properties:SubtitleProperties):SubtitleProperties
{
if (properties == null) properties = {};

if (properties.x == null) properties.x = FlxG.width / 2;
if (properties.y == null) properties.y = (FlxG.height / 2) + 100;
if (properties.subtitleSize == null) properties.subtitleSize = 36;
if (properties.typeSpeed == null) properties.typeSpeed = 0.02;
if (properties.screenCenter == null) properties.screenCenter = FlxAxes.XY;

return properties;
}
}
21 changes: 21 additions & 0 deletions source/SubtitleManager.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package;

import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.FlxG;
import Subtitle.SubtitleProperties;

class SubtitleManager extends FlxTypedGroup<Subtitle>
{
public function addSubtitle(text:String, ?typeSpeed:Float, showTime:Float, ?properties:SubtitleProperties)
{
var subtitle = new Subtitle(text, typeSpeed, showTime, properties);
subtitle.x = (FlxG.width - subtitle.width) / 2;
subtitle.y = ((FlxG.height - subtitle.height) / 2) - 200;
subtitle.manager = this;
add(subtitle);
}
public function onSubtitleComplete(subtitle:Subtitle)
{
remove(subtitle);
}
}

0 comments on commit b042e99

Please sign in to comment.