-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add.messages #15
base: master
Are you sure you want to change the base?
Add.messages #15
Changes from all commits
c983162
f2f8746
066abe1
56cb80b
cbe5f71
c304440
b1a548b
31ee4c3
0baf67a
19f3c2b
010288d
55b050a
79a8692
12d6a06
313a832
8e815a6
d0f5d61
69d77c3
47a8663
38aa953
ee76000
bfdf7d8
8b46094
3af06d0
b3944e0
14e9a3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,97 @@ | ||
body { | ||
background-color: black; | ||
background-color: black; | ||
margin: 0; | ||
padding: 0; | ||
text-align: center; | ||
overflow: hidden; | ||
padding: 0; | ||
text-align: center; | ||
overflow: hidden; | ||
} | ||
|
||
#settings { | ||
width: 15em; | ||
text-align: left; | ||
font-family: 'Courier New', Courier, monospace; | ||
box-sizing: border-box; | ||
position: fixed; | ||
border-right: 1px solid #fff; | ||
border-bottom: 1px solid #fff; | ||
padding: .25em; | ||
color: #fff; | ||
width: 15em; | ||
text-align: left; | ||
font-family: 'Courier New', Courier, monospace; | ||
box-sizing: border-box; | ||
position: fixed; | ||
border-right: 1px solid #fff; | ||
border-bottom: 1px solid #fff; | ||
padding: .25em; | ||
color: #fff; | ||
} | ||
|
||
.settings-line { | ||
height: 1.5em; | ||
height: 1.5em; | ||
} | ||
|
||
.settings-label { | ||
width: 15em; | ||
width: 15em; | ||
} | ||
|
||
.settings-input-text { | ||
width: 3em; | ||
float: right; | ||
width: 3em; | ||
float: right; | ||
} | ||
|
||
canvas { | ||
image-rendering: -moz-crisp-edges; /* Firefox */ | ||
image-rendering: -webkit-crisp-edges; /* Webkit (Safari) */ | ||
image-rendering: pixelated; /* Chrome */ | ||
pointer-events: none; | ||
image-rendering: -moz-crisp-edges; | ||
/* Firefox */ | ||
image-rendering: -webkit-crisp-edges; | ||
/* Webkit (Safari) */ | ||
image-rendering: pixelated; | ||
/* Chrome */ | ||
pointer-events: none; | ||
} | ||
|
||
#main-layers { | ||
position: fixed; | ||
left: 50%; | ||
outline: 1px solid red; | ||
position: fixed; | ||
left: 50%; | ||
} | ||
#main-layers canvas { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
transform: translate(-50%, 0); | ||
-ms-transform: translate(-50%, 0); | ||
background: transparent; | ||
|
||
#static-canvas, | ||
#dynamic-canvas { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
transform: translate(-50%, 0); | ||
-ms-transform: translate(-50%, 0); | ||
background: transparent; | ||
} | ||
|
||
#static-canvas { | ||
z-index: 0; | ||
z-index: 0; | ||
|
||
background-color: white; | ||
background-color: white; | ||
} | ||
|
||
#dynamic-canvas { | ||
z-index: 1; | ||
z-index: 1; | ||
} | ||
|
||
#minimap-canvas { | ||
z-index: 2; | ||
z-index: 2; | ||
|
||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; | ||
overflow: hidden; | ||
padding: 0; | ||
overflow: hidden; | ||
} | ||
|
||
.no-pointer-events { | ||
pointer-events: none; | ||
} | ||
pointer-events: none; | ||
} | ||
|
||
#message-box { | ||
z-index: 2; | ||
border-radius: 6px; | ||
padding-left: 1rem; | ||
padding-right: 1rem; | ||
|
||
position: fixed; | ||
bottom: 20px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||||||||||||||||||||||
import { ActionableEntity } from "./actionable_entity"; | ||||||||||||||||||||||||||
import { Sign } from "./sign"; | ||||||||||||||||||||||||||
import { Sprite } from "./sprite"; | ||||||||||||||||||||||||||
import { Point } from "./point"; | ||||||||||||||||||||||||||
import { angry_dialog, sample_dialog, glitchy_dialog } from "./messages/dialog_graph"; | ||||||||||||||||||||||||||
/* | ||||||||||||||||||||||||||
export function get_actionable_entities(canvas_w?: number, canvas_h?: number): ActionableEntity[] { | ||||||||||||||||||||||||||
return [ | ||||||||||||||||||||||||||
new Sign("angry_dialog", new Sprite(0, 0, 29, 31), new Point(canvas_w / 2 - 15, canvas_h / 2 - 100), 29, 31, true, 0, 1, null, 0.5, angry_dialog), | ||||||||||||||||||||||||||
new Sign("sample_dialog", new Sprite(0, 0, 29, 31), new Point(canvas_w / 2 - 15, canvas_h / 2 - 100), 29, 31, true, 0, 1, null, 0.5, sample_dialog), | ||||||||||||||||||||||||||
new Sign("glitchy_dialog", new Sprite(0, 0, 29, 31), new Point(canvas_w / 2 - 15, canvas_h / 2 - 100), 29, 31, true, 0, 1, null, 0.5, glitchy_dialog) | ||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||
}*/ | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
export function get_actionable_entities(canvas_w?: number, canvas_h?: number): ActionableEntity[] { | ||||||||||||||||||||||||||
return [ | ||||||||||||||||||||||||||
new Sign("angry_dialog", new Sprite(0, 0, 29, 31), null, 29, 31, true, 0, 1, null, 0.5, angry_dialog), | ||||||||||||||||||||||||||
new Sign("sample_dialog", new Sprite(0, 0, 29, 31), null, 29, 31, true, 0, 1, null, 0.5, sample_dialog), | ||||||||||||||||||||||||||
new Sign("glitchy_dialog", new Sprite(0, 0, 29, 31), null, 29, 31, true, 0, 1, null, 0.5, glitchy_dialog) | ||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
Comment on lines
+15
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Les paramètres ne sont pas utilisés : pas la peine d'avoir une fonction pour ça
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Je les utilisais à un moment, d'où la fonction, je réfléchis encore à savoir si on va en avoir besoin ou pas. Pour centrer certains elements sur la carte par exemple. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,52 @@ | ||||||
import { Entity } from "./entity"; | ||||||
import { Sprite } from "./sprite"; | ||||||
import { Point } from "./point"; | ||||||
import { IDrawable } from "./idrawable"; | ||||||
import { IActionable } from "./iactionable"; | ||||||
import { IMAGE_BANK } from "./main"; | ||||||
|
||||||
export abstract class ActionableEntity extends Entity implements IDrawable, IActionable { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Un détail mais en TS j'aime bien préfixer les classes abstraites par un A, je trouve qu'on s'y retrouve mieux, même logique que les noms d'interfaces
|
||||||
public action_hitbox_ratio: number; | ||||||
public action_hitbox: ActionableEntityHitbox; | ||||||
public actionable: boolean; | ||||||
public occuring: boolean; | ||||||
|
||||||
constructor(id: string, current_sprite: Sprite, position: Point, width: number, height: number, | ||||||
has_collision_objects?: boolean, height_perspective?: number, | ||||||
floor_level?: number, room_number?: number, action_hitbox_ratio?: number) { | ||||||
|
||||||
super(id, current_sprite, Point.copy(position), width, height, | ||||||
has_collision_objects, height_perspective, floor_level, room_number); | ||||||
this.action_hitbox_ratio = action_hitbox_ratio == null ? 0 : action_hitbox_ratio; | ||||||
this.actionable = false; | ||||||
this.occuring = false; | ||||||
if (position != null) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Le fait que la position et donc la hitbox soient optionnelles me laisse penser qu'il devrait y avoir un niveau d'abstraction supplémentaire
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fort probable effectivement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. D'un autre côté je me demande si une entité sans position a vraiment du sens There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C'est pour la set de manière différée, il y a un algo qui place certaines collections d'entités de manière aléatoire mais qui a besoin d'attendre que la room soit totalement générée pour prendre compte des espaces indisponibles |
||||||
this.action_hitbox = new ActionableEntityHitbox(this.id + "-hitbox", null, | ||||||
new Point(position.x - width * this.action_hitbox_ratio, position.y - height * this.action_hitbox_ratio), | ||||||
width + width * this.action_hitbox_ratio * 2, height + height * this.action_hitbox_ratio * 2); | ||||||
} | ||||||
} | ||||||
|
||||||
public set_position(position: Point) { | ||||||
this.position = new Point(position.x, position.y); | ||||||
this.action_hitbox = new ActionableEntityHitbox(this.id + "-hitbox", null, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
new Point(position.x - this.width * this.action_hitbox_ratio, position.y - this.height * this.action_hitbox_ratio), | ||||||
this.width + this.width * this.action_hitbox_ratio * 2, this.height + this.height * this.action_hitbox_ratio * 2); | ||||||
} | ||||||
|
||||||
public draw(ctx: CanvasRenderingContext2D): void { | ||||||
ctx.drawImage(IMAGE_BANK.pictures[this.sprite_filename], | ||||||
this.current_sprite.src_x, this.current_sprite.src_y, this.current_sprite.src_width, this.current_sprite.src_height, | ||||||
this.position.x, this.position.y, this.width, this.height); | ||||||
} | ||||||
|
||||||
public abstract action(): void; | ||||||
} | ||||||
|
||||||
export class ActionableEntityHitbox extends Entity { | ||||||
public action_hitbox: Entity; | ||||||
|
||||||
constructor(id: string, current_sprite: Sprite, position: Point, width: number, height: number) { | ||||||
super(id, current_sprite, Point.copy(position), width, height, false); | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.