Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamextreme140 committed Apr 10, 2024
0 parents commit 0982bea
Show file tree
Hide file tree
Showing 24 changed files with 1,137 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.vscode/*
.haxelib/
.github/
export/*
*.code-workspace
# Local history which shouldn't be shared.
.history
.ionide
# ! means a file should be added regardless of it it gets ignored prior.
# Including to allow others to use already set-up configuration tweaked for the project.
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
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": "explicit"
}
},
"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
}
}
]
}
83 changes: 83 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<project>

<!-- _________________________ Application Settings _________________________ -->

<app title="Blackjack_Poker" file="Blackjack_Poker" main="Main" version="0.0.1" company="HaxeFlixel" />

<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
<app preloader="flixel.system.FlxPreloader" />

<!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2-->
<set name="SWF_VERSION" value="11.8" />

<!-- ____________________________ Window Settings ___________________________ -->

<!--These window settings apply to all targets-->
<window width="960" height="720" fps="60" background="#000000" hardware="true" vsync="false" />

<!--HTML5-specific-->
<window if="html5" resizable="false" />

<!--Desktop-specific-->
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" />

<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />

<!-- _____________________________ Path Settings ____________________________ -->

<set name="BUILD_DIR" value="export" />
<source path="source" />
<assets path="assets" />

<!-- _______________________________ Libraries ______________________________ -->

<haxelib name="flixel" />

<!--In case you want to use the addons package-->
<haxelib name="flixel-addons" />

<!--In case you want to use the ui package-->
<haxelib name="flixel-ui" />

<!--In case you want to use nape with flixel-->
<!--<haxelib name="nape-haxe4" />-->

<!-- ______________________________ Haxedefines _____________________________ -->

<!--Enable the Flixel core recording system-->
<!--<haxedef name="FLX_RECORD" />-->

<!--Disable the right and middle mouse buttons-->
<!--<haxedef name="FLX_NO_MOUSE_ADVANCED" />-->

<!--Disable the native cursor API on Flash-->
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->

<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
<haxedef name="FLX_NO_MOUSE" if="mobile" />
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" if="desktop" />
<!--<haxedef name="FLX_NO_GAMEPAD" />-->

<!--Disable the Flixel core sound tray-->
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->

<!--Disable the Flixel sound management code-->
<!--<haxedef name="FLX_NO_SOUND_SYSTEM" />-->

<!--Disable the Flixel core focus lost screen-->
<!--<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />-->

<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
<haxedef name="FLX_NO_DEBUG" unless="debug" />

<!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />

<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
</project>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Simulacion BlackJack

Empty file added assets/data/data-goes-here.txt
Empty file.
Binary file added assets/images/Card_default.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/images/Cartas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions assets/images/Cartas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<TextureAtlas imagePath="Cartas.png">
<!--
Created with ShoeBox
http://renderhjs.net/shoebox/
-->
<SubTexture name="Corazones0000.png" x="676" y="235" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0001.png" x="1012" y="705" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0002.png" x="0" y="1175" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0003.png" x="0" y="940" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0004.png" x="1012" y="470" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0005.png" x="0" y="470" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0006.png" x="0" y="235" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0007.png" x="0" y="0" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0008.png" x="676" y="940" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0009.png" x="169" y="940" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0010.png" x="0" y="1645" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0011.png" x="169" y="0" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Corazones0012.png" x="1012" y="235" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0000.png" x="844" y="1645" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0001.png" x="844" y="1410" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0002.png" x="507" y="235" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0003.png" x="507" y="1410" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0004.png" x="844" y="705" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0005.png" x="507" y="940" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0006.png" x="507" y="470" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0007.png" x="844" y="235" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0008.png" x="676" y="1645" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0009.png" x="676" y="1410" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0010.png" x="507" y="1175" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0011.png" x="676" y="0" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Diamantes0012.png" x="676" y="705" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Joker0000.png" x="507" y="1645" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0000.png" x="1013" y="0" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0001.png" x="338" y="1175" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0002.png" x="338" y="0" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0003.png" x="338" y="940" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0004.png" x="1012" y="940" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0005.png" x="0" y="1410" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0006.png" x="507" y="705" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0007.png" x="0" y="705" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0008.png" x="676" y="1175" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0009.png" x="507" y="0" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0010.png" x="338" y="1645" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0011.png" x="338" y="1410" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Picas0012.png" x="845" y="0" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0000.png" x="844" y="470" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0001.png" x="338" y="705" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0002.png" x="338" y="470" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0003.png" x="338" y="235" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0004.png" x="844" y="940" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0005.png" x="169" y="1645" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0006.png" x="169" y="1410" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0007.png" x="169" y="1175" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0008.png" x="844" y="1175" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0009.png" x="169" y="705" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0010.png" x="169" y="470" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0011.png" x="169" y="235" width="168" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
<SubTexture name="Treboles0012.png" x="676" y="470" width="167" height="234" frameX="-0" frameY="-0" frameWidth="168" frameHeight="234"/>
</TextureAtlas>
Empty file.
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions hxformat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"lineEnds": {
"leftCurly": "both",
"rightCurly": "both",
"objectLiteralCurly": {
"leftCurly": "after"
}
},
"sameLine": {
"ifElse": "next",
"doWhile": "next",
"tryBody": "next",
"tryCatch": "next"
}
}
4 changes: 4 additions & 0 deletions source/AssetPaths.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package;

@:build(flixel.system.FlxAssets.buildFileReferences("assets", true))
class AssetPaths {}
126 changes: 126 additions & 0 deletions source/Cartas.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import haxe.ds.Map;
import objects.Carta;

class Cartas extends FlxTypedGroup<Carta>
{
public var cartas:Map<String, Carta>;

var cartasGeneradas:Array<String>;
var indexNumero:Map<String, String> = [
"A" => "0012", "2" => "0011", "3" => "0010", "4" => "0009", "5" => "0008", "6" => "0007", "7" => "0006", "8" => "0005", "9" => "0004", "10" => "0003",
"J" => "0002", "Q" => "0001", "K" => "0000"
];
var indexNumeroCarta:Array<String> = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"];
var indexPalo:Array<String> = ["Corazones", "Diamantes", "Picas", "Treboles"];

public function new()
{
super(52);
cartas = new Map<String, Carta>();
// generarCartas();
}

public function repartirCarta()
{
var cartaActual = cartas.get(cartasGeneradas[cartasGeneradas.length - 1]);
cartas.remove(cartasGeneradas.pop()); // Retira la carta repartida
return cartaActual;
}
/*
function generarCartas()
{
while (cartasGeneradas.length < 53)
{
var ranPalo = Math.random();
var palo:String; // Nombre del palo
var ranNumero = Math.random();
var numero:String;
var numeroSprite:String;
var numeroCarta:String;
var carta:FlxSprite;
var cartaGenerada:String;
// Palo
if (ranPalo <= 1 / 4)
palo = indexPalo[0];
else if (ranPalo <= 2 / 4)
palo = indexPalo[1];
else if (ranPalo <= 3 / 4)
palo = indexPalo[2];
else
palo = indexPalo[3];
// Numero
if (ranNumero > 0 && ranNumero < 1 / 13)
{
numero = indexNumeroCarta[0];
}
else if (ranNumero > 1 / 13 && ranNumero < 2 / 13)
{
numero = indexNumeroCarta[1];
}
else if (ranNumero > 2 / 13 && ranNumero < 3 / 13)
{
numero = indexNumeroCarta[2];
}
else if (ranNumero > 3 / 13 && ranNumero < 4 / 13)
{
numero = indexNumeroCarta[3];
}
else if (ranNumero > 4 / 13 && ranNumero < 5 / 13)
{
numero = indexNumeroCarta[4];
}
else if (ranNumero > 5 / 13 && ranNumero < 6 / 13)
{
numero = indexNumeroCarta[5];
}
else if (ranNumero > 6 / 13 && ranNumero < 7 / 13)
{
numero = indexNumeroCarta[6];
}
else if (ranNumero > 7 / 13 && ranNumero < 8 / 13)
{
numero = indexNumeroCarta[7];
}
else if (ranNumero > 8 / 13 && ranNumero < 9 / 13)
{
numero = indexNumeroCarta[8];
}
else if (ranNumero > 9 / 13 && ranNumero < 10 / 13)
{
numero = indexNumeroCarta[9];
}
else if (ranNumero > 10 / 13 && ranNumero < 11 / 13)
{
numero = indexNumeroCarta[10];
}
else if (ranNumero > 11 / 13 && ranNumero < 12 / 13)
{
numero = indexNumeroCarta[11];
}
else if (ranNumero > 12 / 13 && ranNumero < 13 / 13)
{
numero = indexNumeroCarta[12];
}
numeroSprite = indexNumero.get(numero);
cartaGenerada = palo + numero; // 'DiamanteA' | 'Trebol10' | ...
numeroCarta = palo + numeroSprite; // 'Diamante0000'
if (cartasGeneradas.contains(cartaGenerada))
continue;
carta = new FlxSprite().loadGraphic("assets/images/Cartas.png");
carta.animation.addByNames(numero, [numeroCarta]);
add(carta);
carta.animation.play(numero);
cartas.set(numero, carta);
cartasGeneradas.push(cartaGenerada);
// carta.animation.play(numero);
}
}
*/
}
13 changes: 13 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package;

import flixel.FlxGame;
import openfl.display.Sprite;

class Main extends Sprite
{
public function new()
{
super();
addChild(new FlxGame(960, 720, PlayState, 60, 60, false, false));
}
}
Loading

0 comments on commit 0982bea

Please sign in to comment.