Spawn Enemies in the near of the Player

0 favourites
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello,

    Ive created a game like Doodle Jump, now i want to create enemies.

    I want that the Enemies will spawn in the near from the Player. But not to

    close, so that the player can jump 4-5 Platforms and there is the Enemie.

  • Why not randomly create the enemy together with each platform (that is allowed to hold enemies)?

    Or check the position of your player (player.y) and run a enemy creation function that creates an enemy on a random platform 600 till 1000 pixels above the player (or other values).

    To do so just use system -> pick (platform) by comparison and compare the y-values.

    Or if enemies are to be in the air, just let the system create an enemy and set their locations in relation to your players position.

    like x: player.x+floor(random(400)) y: player.x+600+floor(random(400))

  • How can i spawn randomly Enemies?

  • I dont understand how i can spawn the enemys in the Air and on the Platform randomly.

    I can let them spawn just in the air and much as platforms they are, but i want that i can say, that i want, that the enemies spawn just for 5%

  • Event:

    every random(1.5,4) seconds

    Action:

    system--> create object

    Player.x + random(-100,101)

    Player.Y

  • Thanks first, one poblem is there, the Enemies dont spawn a little bit away, they spawn there, where the Player is, is it possible to change ?

    That the Monster is much higher than the player?

  • Oh, had a typo ^^

    Increase the numbers.

    x: player.x+floor(random(400)) y: player.y-600-floor(random(400))

    or

    system--> create object

    Player.x + random(-100,101)

    Player.Y -1000

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • exactly, just increase the numbers.

  • Okey, how can i make it, that the Enemies will directly spawn on a Platform and not in the Air ?

  • push

  • + System: for each order by distance (random.X(copy your current random calculation), random.Y, platform.X, platform.Y)

    • Platform: Spawn Enemie or whatever
    • System: Stop loop

    But please forward of asking to much try it by your own, you will learn much more ;)

  • For Each (Ordered) ?

    And then Use Objekt = Platform

    Order = descending ?

    And Expression = (random.X(copy your current random calculation), random.Y, platform.X, platform.Y)

    ???

  • Bump - Sorry for that, but its my last question for finishing my game.

  • Darklinki

    Can you help me one more time ? I dont understand it.

    For Each (Ordered) ?

    And then Use Objekt = Platform

    Order = descending ?

    And Expression = (random.X(copy your current random calculation), random.Y, platform.X, platform.Y)

    Or what did you mean?

  • If have done something like this before:

    + Every 2 seconds

    ++ For each platform order by distance ascending (distance(player.x, player.y - Variable, self.X, self.Y))

    -- Platform Spawn Enemie on Imagepoint(0)

    -- stop loop

    + = Condition

    • = Action

    Variable = A number which says how much the platform with the enemie must be away from the player

    Is it clear now ?

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)