public void Update() { foreach (var item in GameObjectsManager.GetObjects()) { item.Value.Update(); item.Value.Draw(App.Context, camera.PosX - camera.camOffsetX, camera.PosY - camera.camOffsetY); } }
public void Update() { App.ClearContext(); foreach (var item in GameObjectsManager.GetObjects()) { item.Value.Update(); if (camera != null) { item.Value.Draw(App.Context, camera.PosX - camera.camOffsetX, camera.PosY - camera.camOffsetY); } else { item.Value.Draw(App.Context, item.Value.PosX, item.Value.PosY); } } }
private void App_OnClick(MouseEvent arg1, int arg2, int arg3) { var clickX = player.PosX + arg2 - camera.camOffsetX; var clickY = player.PosY + arg3 - camera.camOffsetY; int maxOrder = 0; GameObject clicked = null; foreach (var item in GameObjectsManager.GetObjects()) { if (Click.Clicked(item.Value, clickX, clickY)) { if (item.Value.ObjectId == player.ObjectId) { continue; } if (clicked == null) { clicked = item.Value; } if (maxOrder <= item.Value.order) { maxOrder = item.Value.order; clicked = item.Value; } } } if (clicked != null) { clicked.Click(); if (clicked.ObjectId == map.ObjectId) { SetPlayerDestination(arg2, arg3); } } }