11
Deef
6y

When you have to made a little game with javascript, and because it's your first game you made a beautiful maze with lot of wall.

Ahahah... i'm shit.
I forgot wall have collision.

I'm here now, with 40 different fuckin' walls and much if and else if conditions.

I hate me.

Yeah i know, I can just change my maze but no... I'm lazy. Cry against the collisions is better.

Have good day.

Comments
  • 2
    You could check the pixel values or map the maze walls to an array
  • 1
    I think you should really think about how you check for collision 😂 you dont need to write the check for every wall that you have..
  • 0
    @sharktits I have to use collision function create by my prof it's in the rules of homework and yes i use map to made it easier. But Thx, I just have to think about all differents case, like when i'm between this two wall i just can go forward or backward but not on side....
  • 1
    @simulate yeah I know but i think the probleme is the collision function of my prof, because it dont care of it's collision just on one side or all of my character. So I have to write condition when i dont care of this or this collision and when I can move enven if there is a collision...
  • 3
    @Deef
    I dont think you need that many if statememts.. Just check whether the tile your player wants to move to is a wall, and if so, there is going to be a collision eg. the move is not allowed.

    To check this you just enumerate all the types of tiles (path=0, wall=1, pit=2, ...) and store these type ids for each tile in an array so that you can access it with xy coordinates.
    I dunno, it sounds like you are making it way to complicated 😉
  • 1
    @simulate Yeah good idea, I will see with my prof if it's cheat or not, because i dont use "real collision" but a kind of movement limitation, Thanx. 😉
  • 0
    @Deef
    What kind of game are you making?
  • 1
  • 1
    @simulate A little reflexion game. In the maze you have differents doors, each door go to an other door. So you have to find wich doors take to find the exit.
Add Comment