Need Help Please,
Author |
Message |
Pacman
|
Posted: Sun Oct 29, 2006 2:13 pm Post subject: Need Help Please, |
|
|
Hello,
Need to make a game for programming class and the teacher just doesnt teach, Anyways im starting on my pacmaNbeta game and having some troubles, I got pacman runnin aroound and stuff and i got the board hes runnin round but im having some troubles with the whole colission thing and him not being able to walk thru walls etc. Any help on that would be great and i would love you long time
Thanks
pacmaN, |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
razrdude
|
Posted: Sun Oct 29, 2006 2:19 pm Post subject: (No subject) |
|
|
umm not that i can be of much help, but its easier if you show the code you have so far, so we can properly understand your problem, then maybe some of the "pros" can help. |
|
|
|
|
![](images/spacer.gif) |
md
![](http://compsci.ca/v3/uploads/user_avatars/1849317514ed6c4399768d.png)
|
Posted: Sun Oct 29, 2006 4:20 pm Post subject: (No subject) |
|
|
I know there are tutorials on collision in the [turing tutorials] section. |
|
|
|
|
![](images/spacer.gif) |
richcash
|
Posted: Wed Nov 01, 2006 6:15 pm Post subject: (No subject) |
|
|
This is a good approach for Pacman.
Pacman can be very simple. If you split the screen up into theoretical squares and then assign an array representing each square as a monster, wall, dot, pacman himself, etc, it becomes very easy to detect collision (you just check if the square pacman is in has a monster). And it's not only for very basic games, it's also a good approach for Snake and Tetris (although they involve other things aswell). |
|
|
|
|
![](images/spacer.gif) |
DemonZ
|
Posted: Wed Nov 01, 2006 9:01 pm Post subject: (No subject) |
|
|
For the pacman game, are u using imported pictures or objects created in turing, if there made in turing, i suggest u look up whatdotcolor for your collision, this will only work if u have the objects (walls, pacman, monster) as one solid color, atleast on the outside, this will simplify ur program and make the collision code easier to write and still accurate enough |
|
|
|
|
![](images/spacer.gif) |
DemonZ
|
Posted: Wed Nov 01, 2006 9:05 pm Post subject: (No subject) |
|
|
Now question about the tiles way of detecting collision, how would u have an array represent a square on the screen, would u have to make the array for x and y, and somehow combine them when checking for collision, if u could show me how this work, i could understand it better. because i wouldnt mind experimenting with this "tile style" way of checking for collision. |
|
|
|
|
![](images/spacer.gif) |
richcash
|
Posted: Thu Nov 02, 2006 12:45 pm Post subject: (No subject) |
|
|
I wouldn't call it a way of checking for collision, it's just how most pacman games are made. If you ever play pacman he moves one body length (or one tile at a time). You can never have him half-eating a dot, or half way between two dots. It makes it so simple. It is not THE best way to do things, but it's definetely the easiest way.
You have a two-dimensional array representing the tile's column and row. Each element in the array can be 0 for nothing, 1 for a wall, 2 for a dot, 3 for a monster. Then move your pacman in terms of the columns and rows, and check the array to see what's in the tile pacman is on (if it's a wall, don't let him move there, if it's a dot score increases, if it's a monster lose a life, etc.). |
|
|
|
|
![](images/spacer.gif) |
DemonZ
|
Posted: Fri Nov 03, 2006 1:53 am Post subject: (No subject) |
|
|
Oh ok but could u use it for other such related games, im thinking u could but the tile way would be best for the pacman game. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|