Sprite Movement Patterns?

For questions about using Classic.

Post » Sun Sep 27, 2009 9:16 pm

Hi,

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

Thanks .
My Games on google play

ImageImage
B
30
S
6
G
4
Posts: 97
Reputation: 3,008

Post » Sun Sep 27, 2009 10:18 pm

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
B
2
G
3
Posts: 33
Reputation: 916

Post » Sun Sep 27, 2009 10:20 pm

nevermind, i looked into it, random times are an option but u have to use fuctions and function returns
B
2
G
3
Posts: 33
Reputation: 916

Post » Mon Sep 28, 2009 9:59 am

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.
My Games on google play

ImageImage
B
30
S
6
G
4
Posts: 97
Reputation: 3,008

Post » Mon Sep 28, 2009 3:13 pm

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
B
2
G
3
Posts: 33
Reputation: 916

Post » Mon Sep 28, 2009 3:39 pm

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?
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Mon Sep 28, 2009 3:49 pm

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
B
2
G
3
Posts: 33
Reputation: 916

Post » Tue Sep 29, 2009 3:34 pm

Thanks for the help all, I shall keep persevering.
My Games on google play

ImageImage
B
30
S
6
G
4
Posts: 97
Reputation: 3,008


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests