Discuss Scratch

MasterSPENCER
Scratcher
16 posts

Scrolling game - Enemy collisions and AI

I've been making a scrolling zombie survival game, its been going pretty good, But I've come to the time when I need the AI, spawning and Collisions for the zombies. I've sort of got spawning coded, all it does is spawn clones around the screen, but I don't want them to spawn into a wall, and I don't want them walking through walls, and it would be good if they didn't clump up at walls, but walked around the nearest path to the character. Was just wondering if anyone had any ideas or advice - Thx —-Project Link - https://scratch.mit.edu/projects/162759945/

Last edited by MasterSPENCER (Nov. 12, 2017 21:37:35)

whooshang
Scratcher
100+ posts

Scrolling game - Enemy collisions and AI

You can try to make a hitbox for each zombie, much like one for a player.
You can use cloning to make the hitbox work.

Last edited by whooshang (Nov. 13, 2017 01:07:12)

MasterSPENCER
Scratcher
16 posts

Scrolling game - Enemy collisions and AI

That would work, but they follow the player around and everything is scrolling around them, so if they get caught in a wall and the player is moving away, do they stay there when you come back? or do they delete themselves? I also need a way for them to spawn around the map, without having them be in the players view, so they can be coming towards the player from a different area of the map.
Uniquename1
Scratcher
100+ posts

Scrolling game - Enemy collisions and AI

The way they are now they will be dragged with the player at the edge of the screen. Really all things do that but these zombies are not on the scroll axis as i call it. They move with move and mirror the players movements to still appear to be moving along with you as scrolling happens. As such they will get dragged through the wall on the edge of the screen and continue on afterwards whenever they get the chance and act like nothing happened.

You can set them up on the scroll axis and move them by changing the variable but would not be able to use point and move commands. It would have to be more like comparing scrollx to zombiex with greater and less than and moving to make them come together. With many enemies they tend to stack on top of each other if chasing you for too long.

Then you could deal with walls and be able to have them keep a ‘position’ off screen. Not sure how that would all work with walls off screen and zombies off screen. Likely the walls and the sprites would pile up at the edge of the screen and they'd think they're in a wall all that time. Might be better if they had a zone and played like a zone defense or something. Rather than coming at you always.

A cheap band-aid to avoid all those complications or changing the movement of your zombies that much is simply if it hits a wall back up -3 turn 90 and move 3 steps (actaully 1 step seems to work better for this last one in case its the wrong way he won't zoom through the wall). If he happens to turn the right way he'll get around eventually bumping into the wall as he goes moving 1 step at a time or if not end up getting dragged through the wall as I said above or even turn and walk right through it if he goes the wrong way.

It's certainly not impossible to set up a full on pathfinding script that works with scrolling but would likely need to make better movement for your zombies first. The game in my signature star fighter uses both kinds of movement. The regular fighters move similar to your zombies and the boss moves how things should move on a scrolling map. Luckily in space there are no walls though.

And here is my attempt at the cheap band-aid fix in the zombies movement for walls. https://scratch.mit.edu/projects/186023688/
gtoal
Scratcher
1000+ posts

Scrolling game - Enemy collisions and AI

If you have multiple characters getting into synch when moving around, give them different speeds that are prime numbers - less chance of them getting into lockstep that way.
EggSauceMcNuggets
Scratcher
1 post

Scrolling game - Enemy collisions and AI

ok
da-boss20
Scratcher
1 post

Scrolling game - Enemy collisions and AI

i want my character to be only harmed from one side how would i do that?
deck26
Scratcher
1000+ posts

Scrolling game - Enemy collisions and AI

da-boss20 wrote:

i want my character to be only harmed from one side how would i do that?
Please start by creating a new topic rather than necroposting and share your project.
HCookie2007
Scratcher
1 post

Scrolling game - Enemy collisions and AI

Hi guys, im making a zombie game but i cant ge the zombies to stay on the other side of the wall ive made?? hope u guys can help
ElkhA2025
Scratcher
41 posts

Scrolling game - Enemy collisions and AI

HCookie2007 wrote:

Hi guys, im making a zombie game but i cant ge the zombies to stay on the other side of the wall ive made?? hope u guys can help
No necroposting
TAILSTHEFOX100
Scratcher
6 posts

Scrolling game - Enemy collisions and AI

I'm making a scrolling game using the dot and resize trick, but i cant get a bot with decent collisions to work! Please help me!
xuanrui2012
Scratcher
7 posts

Scrolling game - Enemy collisions and AI

If you want any help go to my profile
My Profile
Yusei-Fudo
Scratcher
1000+ posts

Scrolling game - Enemy collisions and AI

xuanrui2012 wrote:

If you want any help go to my profile
My Profile

If someone needs help, they can ask on this forum instead of your profile. Also, please do not posts on old topics, when you do, it's considered necroposting which is seen as a form of spam.

Powered by DjangoBB