Computer Science Canada How to make "Pacman" stop at a wall |
Author: | falloutboysimpleplan [ Wed Apr 02, 2008 8:32 pm ] |
Post subject: | How to make "Pacman" stop at a wall |
I am pretty new at turing, and am making a Pacman game for school. I am having problems making him not go through the wall I made. I have been trying all day, have read many tutorials about collision and I still don't understand. Can someone please help me? |
Author: | falloutboysimpleplan [ Wed Apr 02, 2008 8:46 pm ] |
Post subject: | RE:How to make "Pacman" stop at a wall |
*sigh* i guess no one's gonna help me... well i give up... ![]() |
Author: | CodeMonkey2000 [ Wed Apr 02, 2008 9:32 pm ] |
Post subject: | RE:How to make "Pacman" stop at a wall |
What method of collision are you trying to implement? And you need to wait longer than 15 minutes for a response ![]() |
Author: | Tony [ Wed Apr 02, 2008 11:30 pm ] | ||||
Post subject: | RE:How to make "Pacman" stop at a wall | ||||
Today at 8:32 pm : ... Today at 8:46 pm : well i give up... Collision detection comes in two major flavours
and
very similar, but they allow for somewhat different implementations. Depends if it's easier to store the location of the walls or the location of... not_walls. Either way, you'd probably need a matrix / grid / 2D array (all the same thing). |
Author: | Jestar [ Thu Apr 03, 2008 8:18 am ] |
Post subject: | RE:How to make "Pacman" stop at a wall |
If your making a simple pacman you could try using View.WhatDotColor |
Author: | Tony [ Thu Apr 03, 2008 9:23 am ] |
Post subject: | RE:How to make "Pacman" stop at a wall |
Ultimately whatdotcolour is the same as a 2D array. Though it has a per-pixel precision and it's contents are shared with graphics, so it's much more error prone. |
Author: | falloutboysimpleplan [ Thu Apr 03, 2008 7:26 pm ] |
Post subject: | RE:How to make "Pacman" stop at a wall |
Thanks for all your help guys, I really appreciate it. My problem is pretty much solved now except for I can't figure out how to make Pacman not go through the wall from the top and the bottom. If anyone has any ideas I'll post my code so far so they can have a look over. Any further help would be greatly appreciated. |
Author: | syntax_error [ Thu Apr 03, 2008 9:16 pm ] |
Post subject: | RE:How to make "Pacman" stop at a wall |
set limits for the pacman limit it's movement set the maxx and maxy values it can go up till. and if you a bit more detailed help post your code so far and we can try to help you do it the best possible way. as a side note, do wait more then 15 mins before giving up. Also dont always count on others to help you. THAT is an important lesson. very. |
Author: | SIXAXIS [ Fri Apr 04, 2008 8:37 pm ] |
Post subject: | Re: How to make "Pacman" stop at a wall |
If you're a beginner and don't know much about Turing, then I would say to use the View.WhatDotColor command. You just choose the pixels to check and it will hceck the colour. So here is an example: % Draw pacman drawfilloval (pacman_x, pacman_y, 10, yellow) if whatdotcolor (pacman_x+11) = blue or whatdotcolor (pacman_x-11) = blue or whatdotcolor (pacman_y-11) = blue or whatdotcolor (pacman_y+11) = blue then STOP PACMAN end if Something like that. The only problem is that nothing else in the game can be blue because it checks the pixel colour, not just what it's drawing or the line colour. |