first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Nuno.hl
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "HashLink",
|
||||
"request": "launch",
|
||||
"type": "hl",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": {
|
||||
"type": "haxe",
|
||||
"args": "active configuration"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "haxe",
|
||||
"args": "active configuration",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
-cp src
|
||||
-lib heaps
|
||||
-lib hlsdl
|
||||
-main Main
|
||||
-debug
|
||||
|
||||
-hl Nuno.hl
|
||||
+45
@@ -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
|
||||
Reference in New Issue
Block a user