Skip to content

Commit 6c38f0b

Browse files
committed
SetActorAttrAction, multiply position by scale
Added check after callbackquee run for scene change
1 parent 4c98fda commit 6c38f0b

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

blade-engine/src/com/bladecoder/engine/actions/SetActorAttrAction.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.bladecoder.engine.actions.ActionCallback;
2323
import com.bladecoder.engine.actions.Param;
2424
import com.bladecoder.engine.actions.Param.Type;
25+
import com.bladecoder.engine.assets.EngineAssetManager;
2526
import com.bladecoder.engine.model.BaseActor;
2627
import com.bladecoder.engine.model.Scene;
2728
import com.bladecoder.engine.model.SceneLayer;
@@ -104,8 +105,10 @@ public boolean run(ActionCallback cb) {
104105
}
105106

106107
if(position != null) {
108+
float scale = EngineAssetManager.getInstance().getScale();
109+
107110
Vector2 pos = Param.parseVector2(position);
108-
actor.setPosition(pos.x, pos.y);
111+
actor.setPosition(pos.x * scale, pos.y * scale);
109112
}
110113

111114
if(scale != null) {

blade-engine/src/com/bladecoder/engine/model/AtlasRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public void startAnimation(String id, int repeatType, int count,
220220
faTween.start(this, repeatType, count, currentAnimation.duration, cb);
221221
}
222222

223-
public int getNumFrames() {
223+
public int getNumFrames() {
224224
return currentAnimation.regions.size;
225225
}
226226

blade-engine/src/com/bladecoder/engine/model/World.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ public void update(float delta) {
210210
timeOfGame += delta;
211211

212212
ActionCallbackQueue.run();
213+
214+
// Check because the ActionCallbackQueue can call to setCurrentScene()
215+
if (assetState != AssetState.LOADED)
216+
return;
217+
213218
getCurrentScene().update(delta);
214219
textManager.update(delta);
215220
timers.update(delta);

0 commit comments

Comments
 (0)