This site requires JavaScript, please enable it in your browser!
Greenfoot back
Pyralis
Pyralis wrote ...

2018/12/13

Need help with Maze/Color detection

Pyralis Pyralis

2018/12/13

#
I'm new to Greenfoot, I'm in the process of making a maze game. I've tried every kind of color detection code that I could find. All aren't working for me. I have a actor that is my maze and an other actor as my player character. Everything I've tried to do to stop you from being able to walk through walls hasn't worked.
danpost danpost

2018/12/13

#
Pyralis wrote...
I'm in the process of making a maze game. I've tried every kind of color detection code that I could find. All aren't working for me. I have a actor that is my maze and an other actor as my player character. Everything I've tried to do to stop you from being able to walk through walls hasn't worked.
Possible solves (from easiest to hardest): * if, walls or paths are a flat color, use that color in your collision detection; * if wall or path are favored with much more red, green or blue, you can use that in your color detection; * otherwise, add Wall actors or Path actors to be used with collision detection; With the first two ways, draw maze on background image, otherwise, there would be maths to deal with to determine which pixel to check (dealing with location and size of maze actor).
You need to login to post a reply.