first commit

This commit is contained in:
nuno
2021-12-10 16:24:13 +04:00
parent 1c25643be7
commit 9cac232a8a
5 changed files with 81 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Nuno.hl
+15
View File
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": {
"type": "haxe",
"args": "active configuration"
}
}
]
}
+13
View File
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "haxe",
"args": "active configuration",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
+7
View File
@@ -0,0 +1,7 @@
-cp src
-lib heaps
-lib hlsdl
-main Main
-debug
-hl Nuno.hl
+45
View File
@@ -0,0 +1,45 @@
import hxd.Key;
class Main extends hxd.App {
var bmp:h2d.Bitmap;
var deplacement = 5;
override function init() {
var tile = h2d.Tile.fromColor(0x0085ff, 100, 100);
bmp = new h2d.Bitmap(tile, s2d);
bmp.x = s2d.width * 0.5;
bmp.y = s2d.height * 0.5;
hxd.Window.getInstance().addEventTarget(onEvent);
}
function onEvent(event:hxd.Event) {
switch (event.kind) {
case EKeyDown:
switch (event.keyCode) {
case 37: // LEFT
bmp.x -= deplacement;
if (bmp.x < bmp.width) bmp.x = bmp.width;
case 38: // UP
bmp.y -= deplacement;
if (bmp.y < bmp.height) bmp.y = bmp.height;
case 39: // RIGHT
bmp.x += deplacement;
if (bmp.x > s2d.width - bmp.width) bmp.x = s2d.width - bmp.width;
case 40: // DOWN
bmp.y += deplacement;
if (bmp.y > s2d.height - bmp.height) bmp.y = s2d.height - bmp.height;
}
case _:
}
}
override function update(dt:Float) {
bmp.rotation += 0.3;
}
static function main() {
new Main();
}
}
// faire une tuile de 100sur100 et de la faire deplacer grace aux fleches