Skip to content

Commit bc48eb1

Browse files
committed
Update player hitTest
1 parent 05228f9 commit bc48eb1

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

Diff for: HaxeGame.hxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
<class path="Source" />
2424
<class path="C:\HaxeToolkit\haxe\lib\openfl\6,1,0\externs\core\openfl" />
2525
<class path="C:\HaxeToolkit\haxe\lib\openfl\6,1,0\externs\extras" />
26-
<class path="Export\android\haxe" />
26+
<class path="Export\html5\haxe" />
2727
</classpaths>
2828
<!-- Build options -->
2929
<build>
30-
<option directives="openfl=6.1.0&#xA;lime=5.4.0&#xA;actuate=1.8.7&#xA;nape=2.0.20&#xA;tools=5.4.0&#xA;no-compilation&#xA;native&#xA;lime-native&#xA;lime-vorbis&#xA;openfl-native&#xA;lime-cffi&#xA;android&#xA;mobile&#xA;android&#xA;android-9&#xA;display" />
30+
<option directives="openfl=6.1.0&#xA;lime=5.4.0&#xA;actuate=1.8.7&#xA;nape=2.0.20&#xA;tools=5.4.0&#xA;howlerjs&#xA;no-compilation&#xA;openfl-html5&#xA;lime-html5&#xA;html5&#xA;web&#xA;html5&#xA;display" />
3131
<option flashStrict="False" />
3232
<option noInlineOnDebug="False" />
3333
<option mainClass="ApplicationMain" />
3434
<option enabledebug="False" />
35-
<option additional="--macro openfl._internal.utils.ExtraParams.include()&#xA;--macro lime.Lib.extraParams()&#xA;--remap flash:openfl" />
35+
<option additional="--macro openfl._internal.utils.ExtraParams.include()&#xA;--macro lime.Lib.extraParams()&#xA;--remap flash:openfl&#xA;-debug " />
3636
</build>
3737
<!-- haxelib libraries -->
3838
<haxelib>

Diff for: Source/Level.hx

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Level
3131

3232
this.player = player;
3333

34-
y = prevLevel == null ? stage.stageHeight - floor.halfHeight : prevLevel.y - 80;
34+
y = prevLevel == null ? stage.stageHeight - floor.halfHeight : prevLevel.y - 90;
3535

3636
floor.position(stage.stageWidth / 2, y);
3737
leftWall.position(leftWall.halfWidth, floor.y - floor.halfHeight - leftWall.halfHeight);
@@ -45,13 +45,13 @@ class Level
4545
);
4646

4747
var ladderX: Float = getRandomXFor(ladder);
48-
ladder.position(ladderX, floor.y - floor.halfHeight - ladder.halfHeight - 20);
48+
ladder.position(ladderX, floor.y - floor.halfHeight - ladder.halfHeight - 30);
4949

5050

5151
var enemyX: Float = getRandomXFor(enemy);
5252

5353
if (prevLevel != null) {
54-
while (enemyX >= prevLevel.ladder.x - 40 && enemyX <= prevLevel.ladder.x + 40) {
54+
while (enemyX >= prevLevel.ladder.x - 60 && enemyX <= prevLevel.ladder.x + 60) {
5555
enemyX = getRandomXFor(enemy);
5656
}
5757
} else {

Diff for: Source/Player.hx

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import nape.callbacks.OptionType;
1212
import nape.geom.Vec2;
1313
import nape.phys.BodyType;
1414
import nape.shape.Polygon;
15+
import openfl.Assets;
1516
import openfl.display.DisplayObject;
17+
import openfl.display.MovieClip;
1618
import openfl.display.Sprite;
1719
import openfl.events.MouseEvent;
1820
import openfl.events.TouchEvent;
@@ -23,9 +25,9 @@ class Player extends Entity
2325
public var isJumping: Bool = false;
2426
public var isBoosted: Bool = false;
2527

26-
private var _width: Float = 20;
27-
private var _height: Float = 20;
28-
private var jumpPower: Float = 100;
28+
private var _width: Float = 30;
29+
private var _height: Float = 30;
30+
private var jumpPower: Float = 200;
2931

3032
override function init()
3133
{
@@ -56,6 +58,11 @@ class Player extends Entity
5658

5759
override function render(): DisplayObject
5860
{
61+
var graphic: MovieClip = Assets.getMovieClip("library:Minazinha");
62+
graphic.width = 30;
63+
graphic.height = 30;
64+
return graphic;
65+
5966
var sprite: Sprite = new Sprite();
6067
sprite.graphics.beginFill(0x0000FF);
6168
sprite.graphics.drawRect(-_width / 2, -_height / 2, _width, _height);
@@ -93,6 +100,7 @@ class Player extends Entity
93100
private function onWallCollision(collision: InteractionCallback)
94101
{
95102
speed *= -1;
103+
display.scaleX *= -1;
96104
move();
97105
}
98106

Diff for: project.xml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<assets path="Assets" rename="assets" />
1414
<assets path="Assets/fonts" rename="fonts" />
1515

16+
<library path="Assets/library.swf" preload="true" />
17+
1618
<window
1719
width="360" height="640"
1820
orientation="portrait"

0 commit comments

Comments
 (0)