GameSalad

Enemy Spawn help

quinn221quinn221 Posts: 268Member, PRO

Hey Guys, I am working on a tank game concept. It is basically a platform game but you are a tank. I am having some issues with my enemy plane spawners. Right now I have it some the enemy will spawn at gameHeroX+800 and Y random (595,650) this works really well until my hero (tank) Y position increases as he makes his way thought the scene. As you would guess as my tank maneuvers up ramps soon or later the plane is at the same Y position.

How can I make it so the plans alway spawn higher than my tanks and at random positions?

Thanks

Comments

  • SocksSocks London, UK.Posts: 12,338Member, BASIC

    Plane X = Hero X + 800
    Plane Y = Hero Y +random (A,B)

  • pHghostpHghost London, UKPosts: 1,866Member

    Spawn Y = game.TankY + random(400,450)

    For example.

    The game.TankY is an attribute you need to make. Either constrain it to the tank Y in the tank actor, or if you don't spawn too often or can deal with small imprecision, just update the game.TankY every 10 seconds or so.

  • pHghostpHghost London, UKPosts: 1,866Member

    Ah, beat to the punch. Sometimes I wish the forums would give you a notification if someone has posted an answer in a thread you are responding to.

    The forum gives you notifications for @ mentions, so should be possible.

  • quinn221quinn221 Posts: 268Member, PRO

    @Socks and @pHghost Thanks Guys!

Sign In or Register to comment.