Jump to content


Photo

couple RTS questions


  • Please log in to reply
3 replies to this topic

#1 SlipknLov

SlipknLov

    GMC Member

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 03 March 2012 - 05:23 AM

spawning units below a building: I have it working for one unit, but i have to move him out of the way before spawning another, or else it'll spawn the new one on top... even though i have the "if place_free" before the spawn code. i've tried "if place_empty," "if !instance_place(objCitizen)," but it still happens. But i intended to eventually put an "else" statement saying if the next spot is open if not the next spot.. but this has been blocking me.

Lastly, the Isometric Z. I have blocks Also with the [end step] event: depth=-y; and i wanted to add a Z value to it.. so i put in the [create] event: z=0;
and then changed the [end step] to:
depth=-(y+z);
and then within the room, i held [Ctrl] and right clicked on 1 block, went to [creation code] and typed: z=32;
then i did the same to another and made it z=64; and i placed them both in their z manner.. (32 and 64 pixels above the ground..)
The depth wasn't working right for those 2.

sorry so much text, but thanks for reading.

Edited by SlipknLov, 04 March 2012 - 12:01 AM.

  • 0

#2 SlipknLov

SlipknLov

    GMC Member

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 03 March 2012 - 05:25 AM

Accidental double-post sorry *.*

Edited by SlipknLov, 03 March 2012 - 05:26 AM.

  • 0

#3 vann

vann

    GMC Member

  • GMC Member
  • 356 posts
  • Version:GM:Studio

Posted 03 March 2012 - 09:45 AM

Ok, so if I understand you correctly, each unit draws its main view sprite + its minimap blip.

What you want to do is seperate this, so that one 'minimap' object draws the minimap dots for each unit. That way you just set the depth of the minimap object how you want it.

So in the minimap object draw event something like:

with(units){
     [whatever your draw code for the minimap blip was]
}

For your second problem, we might need to see more code, as if you are hecking for the instance first, it should work. One thing though, are you using a collision mask? if so what does it look like?

As for your depth problem, Im not sure, I've used a similar system before without trouble. Are you sure your not overidding the depth code somewhere?

Edited by vann, 03 March 2012 - 09:50 AM.

  • 0

#4 SlipknLov

SlipknLov

    GMC Member

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 04 March 2012 - 12:04 AM

Thanks, that solved my first problem.
As for my next:
      { if (global.food>19) then
        {
        if place_empty(selected.x,selected.y+80) then
         {
          instance_create(selected.x,selected.y+80,objCitizen1);
          global.food-=20;
         }
       }
      }
it simply doesn't register my "if place_free" statement..
Yes they have bounding boxes, they are 16x16 squares on the bottom-half of the image. The origin is in the center of the bounding box.

And i've tripple - quadruple checked my depth code for my isometric blocks, and that's really all i've done with it; i've searched for overriding or contradicting code, and found nothing. i just think i'm doing it wrong..

Edited by SlipknLov, 04 March 2012 - 12:07 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users