Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
merge someAdjustments into main (#55)
Browse files Browse the repository at this point in the history
* Modified Textures to optimal size, Deleted unused files

* Made Player responsive to mouse position, deleted unused code

* Implement Player backwords walking

* Made Canvas responsive to width of screen

* Branch rebased

* Fix player direction

Fix player direction
Fix player arm direction
Fix canvas scaling leading to InputHandler mouse offset.
Remove PortalEntity debug message on teleport.

---------

Co-authored-by: Kitt3120 <torben@schweren.dev>
  • Loading branch information
Quadral1403 and Kitt3120 authored Jun 12, 2023
1 parent afb80d0 commit a134ec4
Show file tree
Hide file tree
Showing 18 changed files with 400 additions and 498 deletions.
Binary file removed src/assets/playerJump.png
Binary file not shown.
Binary file removed src/assets/playerRunLeft.png
Binary file not shown.
Binary file removed src/assets/playerRunRight.png
Binary file not shown.
28 changes: 0 additions & 28 deletions src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
<script type="module" src="game/main.js"></script>
</head>
<body>
<img
src="assets/icons.png"
class="image"
id="icons"
alt=""
style="display: none"
/>
<img
src="assets/bottomBrick.png"
class="image"
Expand Down Expand Up @@ -51,27 +44,6 @@
alt=""
style="display: none"
/>
<img
src="assets/playerJump.png"
class="image"
id="playerJump"
alt=""
style="display: none"
/>
<img
src="assets/playerRunRight.png"
class="image"
id="playerRunRight"
alt=""
style="display: none"
/>
<img
src="assets/playerRunLeft.png"
class="image"
id="playerRunLeft"
alt=""
style="display: none"
/>
<img
src="assets/characterRight.png"
class="image"
Expand Down
24 changes: 17 additions & 7 deletions src/html/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@
text-align: center;
}

#game-canvas {
display: block;
margin: 0 auto;
height: 100%;
@media (orientation: portrait) {
#game-canvas {
display: block;
margin: 0 auto;
width: 100%;
}
}

@media (orientation: landscape) {
#game-canvas {
display: block;
margin: 0 auto;
height: 100%;
}
}

.page {
color: white;
background-color: rgba(44,34,34,255);
background-color: rgba(44, 34, 34, 255);
height: 100%;
}

body {
font-family: 'Roboto', sans-serif;
font-family: "Roboto", sans-serif;
font-size: 16px;
margin: 0;
padding: 0;
Expand All @@ -28,4 +38,4 @@ html {
width: 100%;
margin: 0;
padding: 0;
}
}
4 changes: 4 additions & 0 deletions src/ts/engine/entitiy/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class Entity {
return this._centerOfMass;
}

set centerOfMass(centerOfMass: Vector2D) {
this._centerOfMass = centerOfMass;
}

get centerOfMassAbsolute(): Vector2D {
return this._location.add(this._centerOfMass);
}
Expand Down
99 changes: 0 additions & 99 deletions src/ts/game/entities/networkentity.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/ts/game/entities/networkentity2.ts

This file was deleted.

64 changes: 64 additions & 0 deletions src/ts/game/entities/playerarm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import AssetManager from "../../engine/assets/assetmanager.js";
import ConditionalTexture from "../../engine/assets/texture/conditionaltexture.js";
import Texture from "../../engine/assets/texture/texture.js";
import Services from "../../engine/dependencyinjection/services.js";
import Entity from "../../engine/entitiy/entity.js";
import Direction from "../../engine/math/direction.js";

class PlayerArm extends Entity {
private _direction: Direction;

public get direction(): Direction {
return this._direction;
}

public set direction(value: Direction) {
this._direction = value;
}

public constructor(
x: number,
y: number,
rotation: number,
centerOfMassX: number,
centerOfMassY: number,
scalingX: number,
scalingY: number,
widthExpansion: number,
heightExpansion: number
) {
super(
x,
y,
rotation,
centerOfMassX,
centerOfMassY,
scalingX,
scalingY,
widthExpansion,
heightExpansion,
true,
new ConditionalTexture(
Services.resolve<AssetManager>("AssetManager").getTexture(
"playerArmRight"
),
new Map<Function, Texture>([
[
() => this._direction === Direction.Left,
Services.resolve<AssetManager>("AssetManager").getTexture(
"playerArmLeft"
),
],
]),
100
)
);

this._direction =
rotation > 70 || rotation < -110 ? Direction.Left : Direction.Right;
}

public update(delta: number): void {}
}

export default PlayerArm;
35 changes: 0 additions & 35 deletions src/ts/game/entities/playerarmright.ts

This file was deleted.

Loading

0 comments on commit a134ec4

Please sign in to comment.