Log In  

I am creating smart monsters which can detect obstacles. Objects in yellow circles are obstacles. Red circles are where they can jump

Ignore two yellow circles on both left and right sides of the map
When user is in higher place than monster, monster should find place which they can jump. If monsters are under obstacles, they should not jump.

These obstacles(floors) are drawn so.

Unfortunately, I don't know how to do that. I know how to detect enemies' position but not position of obstacles.

I am not asking do that for me. I am just wondering what should and what can I do!

Any help, advice, tip will be grateful!

P#51536 2018-04-12 05:03 ( Edited 2018-04-16 07:24)

:: Davbo

So I'm going to assume if you have floor collision you are now farmilliar with mget to check flags of tiles on the map, right?

The simplest way would be to have a blank tile with a specific flag, put that on the map, then if your enemy collides with that do their logic for if they should jump up to the next floor or not.

Does that make sense?

P#51542 2018-04-12 09:17 ( Edited 2018-04-12 13:17)

Davbo Oh thank you!
Now I have a Idea.

First check enemy's x position than, check tiles which shares same x position as enemy with higher y position. If mget returns nothing or false, allow jump. If it mget finds tiles than no jump.

Am I right?

P#51544 2018-04-12 09:47 ( Edited 2018-04-12 13:47)
:: Davbo

I don't know your code, but sure. There are lots of ways to use mget so play around and see what works for you. Remember there is always the Pico 8 wiki if you want some hints and tips on a specific function. Just Google Pico 8 wiki and you'll find it.

P#51545 2018-04-12 10:04 ( Edited 2018-04-12 14:04)

Along the lines if what @Davbo suggests: add another map with meta information for the npc.
That map is not drawn, only checked to trigger various actions.
Super Crate Box doesn’t have gazillion of maps nor sprites, that should work just fine.

P#51549 2018-04-12 12:49 ( Edited 2018-04-12 16:49)

What he was suggesting is putting an invisible tile with a "jump" flag checked. So when enemies come to it they know to jump. Like imagine putting a spring on the ground when they get to it, they jump. Except you just make the sprite for the spring so it's invisible. Then you just tell your enemies to use the spring only if the player's y is greater than their y.

P#51551 2018-04-12 13:02 ( Edited 2018-04-12 17:02)
:: Felice

You could also use sprite flags. For your "edge" tile sprites, set one of the eight flags to say it's a jumpable area. You could even use two of them to say which directions are available to jump. Then you look up the sprite tile the NPC is standing on in the map, check its flags, and let the NPC do its thing.

(Or have a lookup table in your code that's keyed on tile ID or the x,y location on screen and says what interesting landmarks are there.)

P#51565 2018-04-12 23:58 ( Edited 2018-04-13 04:02)

Thanks for this post, I didn't know about these flags, it blew my mind, I can do so many things with them!

P#51583 2018-04-13 12:57 ( Edited 2018-04-13 16:57)

Thank you every body. I saw answers just now. I will try what I can!

P#51667 2018-04-16 03:24 ( Edited 2018-04-16 07:24)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-04-09 23:47 | 0.023s | 4194k | Q:29