Sprite Movement Patterns?

This forum is currently in read-only mode.
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Hi,

    I�m creating a basic side-scrolling space shooter as a first project and slowly but surely making progress. I�ve got as far as simple player control, shooting, and basic scrolling background. I�m having difficulty trying to figure out is how to implement enemy sprites movement patterns, and timing of these as the level progresses. What�s the best way to do this? Not sure where to begin. Suggestions and tips are much appreciated.

    Thanks .

  • i too am making a platformer, and ive been dwelling on a more AI feel to the enemies, would be nice if u can set up a random amount of tics and millisecond, then have the action set a random variable between 1 and 2, which would depict which direction the enemy is facing, and a counter condition that says this is only true if player isnt in LOS or X distance, would give the illusion of a wondering enemy

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • nevermind, i looked into it, random times are an option but u have to use fuctions and function returns

  • Questions that initially come to mind for me are,

    Would you have an instance of every sprite off screen and then move these on screen when needed?

    Or would you spawn copies of sprites in �attack� formations moving these from right to left as level progresses?

    How do you time implement these

    What I get stuck with is how you would manage this in construct so I can experiment with ideas.

  • well its really cool, what i did was i made an event, that for each "enemy"(family), and second condition, every random(2000) milliseconds. set private variable "move" to random(2)

    this will mean that for every monster that u have in the family, it will set their own private variable 0 or 1 at their own random time

    make some events for the family such as if private variable "move" is equal to 0 then set angle to 0

    and make the same for 1 to equal 180.

    i did it for my game and i also gave them a line of site with a range of 250 and once in LOS they would act like the kooper monsters in the platformer game. ill upload a cap of my game to show u, but u are WARNED: i dont excercise organizing my events very well lol.

    http://www.box.net/shared/q7uasu3ox0

    the example is on layout two, ull notice that all of them are same monsters in random patterns and ALL of them walk independantly even when each monster is just another instance of the first ones i created

  • I've found the best way to manage enemies is to have all of them in a separate layout that never gets loaded. Then through events you can spawn them into your current layout at whatever position you want.

    For attack patterns, try giving each enemy type a PV "pattern" that controls how it will move:

    if pattern = 0

    -> fly straight code

    if pattern = 1

    -> wave movement code

    etc

    To have a formation, when spawning in enemies use the "repeat" condition and just offset the x or y positon and set their pattern to the same number.

    As for the time implementation, couldn't you use the "compare time" condition?

  • i was just giving him something that would give his enemies a truly RANDOM factor of movement. didnt say my way was the only way

  • Thanks for the help all, I shall keep persevering.

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