Skip to content

Commit 3abfce7

Browse files
committed
container
1 parent dd9735a commit 3abfce7

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

notes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SlotVert handles rotation of slotted objects
2+
13
Animations
24
xOscPerSec= move left and right over the x-axis (speed)
35
xAmp = distance moved

src/Main.hx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ class Main #if openfl extends Sprite #end
312312
}
313313
if (Bind.playerUse.bool)
314314
{
315-
//program.use(selectX,selectY);
316-
//player.hold();
315+
program.use(selectX,selectY);
316+
player.hold();
317317
//animation section
318-
var tile:Tile = null;
318+
/*var tile:Tile = null;
319319
var animation = objects.objectMap.get(player.instance.po_id).animation;
320320
trace(" map " + animation);
321321
if (animation != null)
@@ -330,7 +330,7 @@ class Main #if openfl extends Sprite #end
330330
i++;
331331
}
332332
}
333-
}
333+
}*/
334334
//var record = map.animation.record;
335335
/*for (i in 0...record.params.length)
336336
{
@@ -347,6 +347,11 @@ class Main #if openfl extends Sprite #end
347347
{
348348
//fix crash
349349
if (player == null) return;
350+
if (Bind.command)
351+
{
352+
mouseRightDown(null);
353+
return;
354+
}
350355
if (Bind.playerMove.bool)
351356
{
352357
program.path(selectX,selectY);
@@ -486,20 +491,22 @@ class Main #if openfl extends Sprite #end
486491
//add object arraqy
487492
public function add(array:Array<Int>,x:Int,y:Int,container:Bool=false,push:Bool=true)
488493
{
489-
var sub:TileContainer = null;
490494
if (array != null)
491495
{
492496
objects.add(array[0],x,y,array.length > 1 ? true : container,push);
493497
objects.containing = array.length > 1 ? array[0] : 0;
498+
var index:Int = 0;
494499
for (i in 1...array.length)
495500
{
496501
if (array[i] < 0)
497502
{
498503
//sub container
499-
objects.add(array[i] * -1,x,y,true,push);
504+
objects.add(array[i] * -1,x,y,true,push,index);
505+
index++;
500506
}else{
501507
//container
502508
objects.add(array[i],x,y,container,push);
509+
index = 0;
503510
}
504511
}
505512
}

src/game/Objects.hx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Objects extends TileDisplay
9090
}
9191
return data;
9292
}
93-
public function add(id:Int,x:Int=0,y:Int=0,container:Bool=false,push:Bool=true):Bool
93+
public function add(id:Int,x:Int=0,y:Int=0,container:Bool=false,push:Bool=true,index:Int=0):Bool
9494
{
9595
//return false;
9696
if(id <= 0) return false;
@@ -184,7 +184,8 @@ class Objects extends TileDisplay
184184
}else{
185185
p.x = x * Static.GRID;
186186
p.y = (Static.tileHeight - y) * Static.GRID;
187-
group.addTileAt(p,0);
187+
//group.addTileAt(p,0);
188+
group.addTile(p);
188189
}
189190
}
190191
p.addTile(sprite);
@@ -200,14 +201,17 @@ class Objects extends TileDisplay
200201
if (containing > 0)
201202
{
202203
//pos
203-
getObjectData(containing).
204+
var pos = getObjectData(containing).slotPos[index];
205+
sprite.x += pos.x;
206+
sprite.y += pos.y;
204207
}
205208
object.addTile(sprite);
206209
sprites.push(sprite);
207210
}else{
208211
sprite.x += x * Static.GRID;
209212
sprite.y += (Static.tileHeight - y) * Static.GRID;
210-
group.addTileAt(sprite,0);
213+
group.addTile(sprite);
214+
//group.addTileAt(sprite,0);
211215
sprites.push(sprite);
212216
}
213217
}

src/settings/Bind.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@ class Bind
3030
public static var settings:Action = new Action([Keyboard.ESCAPE]);
3131

3232
public static var start:Action = new Action([Keyboard.ENTER]);
33+
34+
//command for right click without a mouse on mac
35+
public static var command:Bool = false;
3336

3437

3538
public static function keys(e:KeyboardEvent,bool:Bool)
3639
{
40+
if (e.keyCode == Keyboard.COMMAND) command = bool;
41+
3742
zoomIn.set(e,bool);
3843
zoomOut.set(e,bool);
3944

0 commit comments

Comments
 (0)