Page 1 of 1

Example 15.1-isoimages help

PostPosted: Sun Mar 01, 2015 1:33 pm
by Tananez
Hi!
I plan to buy this engine because i never seen one like this , much more the ui and depth its fantastic .
Right now i have no money , and im very poor , i live in Romania , i earn 140 euro / month , with this ammound can barely live , and the products cost like rest of europe and some of them mby even more.

I want to build a litle game , make some money to get this full source with last updates , to further develop .
Right now i still learn how it works , i learn fast .

I have found this Example 15.1-isoimages , i post an image.

My Problem is that i dont know to make 2 things.
1. The space outside the grid to be ocupied so no other buildings cant be build in that area or to be moved. (i have paint with blue)
2. The map to be limited in width and height , lets say 2000px X 1700px (when its dragged to not move more then the limit width and height)


I realy need this please help me .





Image

Re: Example 15.1-isoimages help

PostPosted: Mon Mar 02, 2015 3:29 pm
by robaldred
Hey welcome,
No worries the engine is free to use for non-commerical use. Just so you know if you are selling access to the game or other in-game purchases you must buy a licence for the engine.

To answer your questions, you can achieve what you're after with a little coding.


1.
I'm going to assume you have a method which is handling the mouse click and placement of objects.
In that method you could do a simple check to ensure the click tile is within the grid.
Code: Select all
if(selectedtile.x < 0 || selectedtile.y < 0 || selectedtile.x > tileMap.gridSize().x || selectedtile.y > tileMap.gridSize().y) {
   // this tile is outside the grid
   // don't place/move object
} else {
  // inside the grid
  // do the work here to place/move the object
}


2.
You can use the limit() method on your viewport mousepan component to stop the camera from moving beyond that limit.
This limit method takes a single argument of an IgeRect
Something like....

Code: Select all
    limit = new IgeRect(0, 0, tileMap.width(), tileMap.height());
    viewport.mousePan.limit(limit);