Skip to content

Commit

Permalink
diminui tamanho dos fundos pra ver se aparecem nos mobiles
Browse files Browse the repository at this point in the history
  • Loading branch information
dremendes committed Apr 9, 2020
1 parent 6bf7d86 commit 379e248
Show file tree
Hide file tree
Showing 9 changed files with 2,471 additions and 116,989 deletions.
119,414 changes: 2,438 additions & 116,976 deletions Bozorun.js

Large diffs are not rendered by default.

Binary file modified assets/images/backgrounds/bgnovo.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/images/backgrounds/bgnovo02.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/images/backgrounds/bgnovo04.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/images/backgrounds/bgnovo06.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/images/backgrounds/bgnovo08.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/images/backgrounds/bgnovo10.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 manifest/default.json

Large diffs are not rendered by default.

44 changes: 32 additions & 12 deletions source/BozoRunGameState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BozoRunGameState extends FlxState
private static var random = new FlxRandom();

// base speed for player, stands for xVelocity
private static inline var BASE_SPEED:Int = 200;
private static inline var BASE_SPEED:Int = 400;

// how fast the player speeds up going to the right
private static inline var xAcceleration:Int = 120;
Expand Down Expand Up @@ -63,9 +63,11 @@ class BozoRunGameState extends FlxState

// where to start generating platforms
private var _pontaDireitaCenario:Int;
private var _posicaoOcupadaX:Float=0;
private var _permiteSpawn:Bool=false;

// background image
private var _bgImgGrp:FlxSpriteGroup;
private var _fundosGrupo:FlxSpriteGroup;
private var _fundoCeu:FlxBackdrop;
private var _fundoCenario:FlxBackdrop;
private var _floor:FlxBackdrop;
Expand Down Expand Up @@ -132,12 +134,13 @@ class BozoRunGameState extends FlxState
{
_fundoCeu = new FlxBackdrop(AssetPaths.sky__png, 0.1, 0, true, false, 0, 0);
_fundoCenario = new FlxBackdrop(AssetPaths.bgnovo__png, 0.4, 0, true, false, 0, 0);
_bgImgGrp = new FlxSpriteGroup();
_fundoCenario.scale.set(1.5, 1.5);
_fundosGrupo = new FlxSpriteGroup();

_bgImgGrp.add(_fundoCeu);
_bgImgGrp.add(_fundoCenario);
_fundosGrupo.add(_fundoCeu);
_fundosGrupo.add(_fundoCenario);

this.add(_bgImgGrp);
add(_fundosGrupo);
}

private inline function configurarBozo():Void
Expand Down Expand Up @@ -223,8 +226,8 @@ class BozoRunGameState extends FlxState
_laranja3.visible = false;
add(_laranja3);

_fundoCenario.y += 30;
_fundoCeu.y -= 70;
_fundoCenario.y += 90;
_fundoCeu.y -= 40;

_score = _record;
}
Expand Down Expand Up @@ -279,6 +282,13 @@ class BozoRunGameState extends FlxState
_piscando = true;
var _timerPiscando = new haxe.Timer(3000);
_timerPiscando.run = () -> { _piscando = false; _bozo.visible = true; _timerPiscando.stop(); }

var _timerSpawn = new haxe.Timer(300);
_timerSpawn.run = () -> {
_permiteSpawn = true;
var _timerPermite = new haxe.Timer(10);
_timerPermite.run = () -> { _permiteSpawn = false; _timerPermite.stop(); }
}
}

private inline function initPlatforms():Void
Expand Down Expand Up @@ -469,6 +479,13 @@ class BozoRunGameState extends FlxState
_oranges.forEach( (orange) -> if (orange.x < (_bozo.x - 35)) orange.destroy() );
}
}

private inline function gerarIntForaDaFaixaX(x:Float, _rangeProibido:Float):Float{
var randomIntPosX:Float = _bozo.x + FlxG.width + random.int(300, 350);
return ((x - _rangeProibido) > randomIntPosX) || ((x + _rangeProibido) < randomIntPosX)
? randomIntPosX
: gerarIntForaDaFaixaX(x, _rangeProibido);
}

private inline function setObjAndAdd2Group(Path:FlxGraphicAsset,
width:Int,
Expand All @@ -478,10 +495,11 @@ class BozoRunGameState extends FlxState
isMovable:Bool=true):Void
{
var obj = new AssetLoader(Path, width, height);
obj.x = (_bozo.x + FlxG.width) + random.int(300, 350);
obj.x = gerarIntForaDaFaixaX(_posicaoOcupadaX, 30);
obj.y = random.int(140, 250);
obj.solid = isSolid;
obj.immovable = isMovable;
_posicaoOcupadaX = obj.x;
add(obj);
group.add(obj);
}
Expand All @@ -490,8 +508,10 @@ class BozoRunGameState extends FlxState
{
_pontaDireitaCenario += TILE_WIDTH*2;

if (random.int(0, 20) / 20 == 0) setObjAndAdd2Group(_arrayLivros[random.int(0, 5)] , 45, 55, _books, true, true);
if (random.int(0, 50) / 50 == 0) setObjAndAdd2Group(AssetPaths.laranja__png, 23, 23, _oranges, true, false);
if(_permiteSpawn) {
if (random.int(0, 2) / 2 == 0) setObjAndAdd2Group(_arrayLivros[random.int(0, 5)] , 45, 55, _books, true, true);
if (random.int(0, 5) / 5 == 0) setObjAndAdd2Group(AssetPaths.laranja__png, 23, 23, _oranges, true, false);
}

_change = true;
}
Expand Down Expand Up @@ -539,7 +559,7 @@ class BozoRunGameState extends FlxState
_fundoCeu.destroy();
_fundoCenario.destroy();
_floor.destroy();
_bgImgGrp.destroy();
_fundosGrupo.destroy();
_collisions.destroy();
_books.destroy();
_oranges.destroy();
Expand Down

0 comments on commit 379e248

Please sign in to comment.