From 327309269141867f6ba2f773250c0ea5ef44a6db Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 2 Jan 2017 00:31:55 -0500 Subject: [PATCH] v0.5.0: cell selecting now prioritizes monster sprites over tiles on the ground. --- .../shatteredpixeldungeon/scenes/CellSelector.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java index c08fc0bf0..bd5446082 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/CellSelector.java @@ -20,11 +20,13 @@ */ package com.shatteredpixel.shatteredpixeldungeon.scenes; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.watabou.input.Touchscreen.Touch; +import com.watabou.noosa.Camera; import com.watabou.noosa.TouchArea; import com.watabou.utils.GameMath; import com.watabou.utils.PointF; @@ -52,6 +54,14 @@ public class CellSelector extends TouchArea { } else { + PointF p = Camera.main.screenToCamera( (int)touch.current.x, (int)touch.current.y ); + for (Char mob : Dungeon.level.mobs){ + if (mob.sprite != null && mob.sprite.overlapsPoint( p.x, p.y)){ + select( mob.pos ); + return; + } + } + select( ((DungeonTilemap)target).screenToTile( (int)touch.current.x, (int)touch.current.y,