Slick Forums

Discuss the Slick 2D Library
It is currently Wed May 18, 2022 9:34 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sat Jan 19, 2013 5:22 am 

Joined: Tue Oct 16, 2012 12:36 am
Posts: 73
I have an enemies class set up for my platformer, and have ran into a little problem. I have the movement, and enemies set up fine, I've integrated them into my main class, and everything is running smoothly, but the only problem is that the enemies fall off the map easily. Since I gave the enemies random X, and Y spawning, they had to adhere to gravity, in order to make sure I didn't have floating AI. So if the enemy is not touching a tile, he should fall, that works well and all, except for when he is on the bottom layer, and decides to fall through into a bottomless pit so to speak. I was wondering how I could have the enemy avoid going of the edge of a platform. My first thought was to draw walls at the ends of each section, but that seems inefficient. Does anyone have any ideas as to how I could give the AI some brains to change his x axis direction away from the edge of the platform. I hope my explanation is understandable to some degree.

EDIT: I fixed it. I just drew a giant polygon across the bottom of the map, and set it so that the player cannot fall, and that he must reverse his direction if he collides with the ground polygon.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 10 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group