Weekly Qbasic and Qb64 Lesson Topics
July 22, 2018, 05:11:34 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

PacMan2f This one moves with arrow keys


Pages: 1 2 [3] 4
  Print  
Author Topic: PacMan2f This one moves with arrow keys  (Read 3076 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #30 on: March 13, 2011, 11:51:04 pm »

Here are 4 new ghosts,..on sa sprite sheet, if they seem ok, I can do the other 12, and put them all on one sheet (all 16) or Is it better 1 Sprt sheet for each 4 ? They are pretty big, to make it easy for me to edit, and draw them.You will notice the ghost seems a little smaller, in the up,or front faceing view, thats ok, I am hopeing it will give a slight effect, of changeing size, the frame is still the same size square.But if you don't like it, I can change it, the other colors would be basicly the same, if these work well.
The Fullsize Sprt sheet
http://dl.dropbox.com/u/15387474/GhostSprts_blu.bmp
-----------------------------------------------------
Attached are some little ones, that are 20 x 20 frames, but when I reduced them, it may not have scaled right....don't know if the frames will work right.
from Garry
Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #31 on: March 14, 2011, 12:53:03 am »

You may be right, but I think I like these,to be honest, it is hard to tell,until it is the maze and moveing around, would that be to hard at this point ? to just do the one ( 4 frames),.. no real need for the pacman, but that would be interesting too,...When I see how this one looks inside the walls, and when he goes up or down,left or right,...I will know more clearly, which is why I kind of want to wait on the others,...Also, the others, the colors, I was thinking pink, red, and a Darker Blue (but that still show on the black well), will that be anyproblem, in relation to color blindness ? I guess green is not a good option ?
from Garry
Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #32 on: March 14, 2011, 01:43:48 am »

Not sure on the yellow, the others yes, I am going to look now, before I go to sleep,...
from Garry
Report Spam   Logged

guest
Guest
« Reply #33 on: March 15, 2011, 07:31:41 am »


    Here's a demo with your ghosts Garry. I reduced the overall size of the graphic sheet to 800,200. This makes each individual graphic 200 x 200.
Here the link to the graphic:http://dl.dropbox.com/u/10291175/GhostBlue1.rar
Code:
REM
DEFLNG A-Z

Sprite& = _LOADIMAGE("GhostBlue1.bmp", 32)
Video& = _NEWIMAGE(800, 600, 32)

SCREEN Video&
_PUTIMAGE (50, 199)-(750, 399), Sprite&, Video&
LINE (50, 199)-(750, 399), _RGB32(255, 255, 0), B
PAINT (10, 10), _RGB32(255, 255, 255)
x = 10: y = 10: State = 1

DO
  _LIMIT 100

  _PUTIMAGE (50, 199)-(750, 399), Sprite&, Video&
  LINE (50, 199)-(750, 399), _RGB32(255, 255, 0), B

  SELECT CASE State
    CASE IS = 1
      x = x + 1
      IF x >= 750 THEN
        x = 750: State = 2
      END IF
      _PUTIMAGE (x, y)-(x + 40, y + 40), Sprite&, Video&, (0, 0)-(199, 199)
    CASE IS = 2
      y = y + 1
      IF y >= 550 THEN
        y = 550: State = 3
      END IF
      _PUTIMAGE (x, y)-(x + 40, y + 40), Sprite&, Video&, (200, 0)-(399, 199)
    CASE IS = 3
      x = x - 1
      IF x <= 10 THEN
        x = 10: State = 4
      END IF
      _PUTIMAGE (x, y)-(x + 40, y + 40), Sprite&, Video&, (400, 0)-(599, 199)
    CASE IS = 4
      y = y - 1
      IF y <= 10 THEN
        y = 10: State = 1
      END IF
      _PUTIMAGE (x, y)-(x + 40, y + 40), Sprite&, Video&, (600, 0)-(799, 199)
  END SELECT

  _DISPLAY
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM

« Last Edit: September 17, 2011, 09:53:09 am by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #34 on: March 15, 2011, 07:54:45 pm »

Not sure on the yellow, the others yes, I am going to look now, before I go to sleep,...
from Garry
I had forgotten, the colors are,RED, ORANGE, BLUE, PINK
 The moveing ghost,...thats pretty good, and I can use the same, code to
view the others,....
 I think I would like to make the ghost, with more movement,.if you notice in the game I sent you for Dos, they litlle "feet" like things, at the bottom,..I am thinking these (originals) are done with data bit map. ,I suspect,...it is a little hard to explain, especially since I don't know exactly how the effect is accomplished,...
If I make a few more frames,so we have a animation, giveing a rippleing effect, of the bottom part or the ghost, and the eyes moveing. I hope I make sense,.... Your code is fine, for these, but to be honest, I am not to happy with them, (the ghosts)
 I am going to make some new ones, not sure, how soon, as I have to go out of town, tommorow, for a job we are doing, it may be the weekend before,  I can do it,... I will make a gif, animation, but the .png images that are use to make the animation, are easily converted to .bmp and then put on a sprite sheet, actually, useing Unseens sprite sheet maker , BMP or PNG
dose not matter, the sprite sheet is saved as BMP.
 Anyway, THANKS!, because now, I have a very clear idea of how to do this Ghost,....the next ones will be "perfect",..! ( I hope)  I am sort of  "thinking out loud.
 I have already seen in some of your DEMOS, you will know how, to load the
sprite, (sprite sheet), with _putimage....and the ghost will have the movments, "rippleing" or "shimmering" effect I am after.I did notice also in the original game, like yu said, they eye movement, and also, the ghosts, do not rotate,...they are the same,..just the "feet" thingys, and the eyes, are moveing,... Guess thats about it, thanks, on this "mini program", it definately worked, for what I needed to see....
from Garry
Report Spam   Logged

guest
Guest
« Reply #35 on: March 15, 2011, 08:54:07 pm »


ere are some freeware pac man graphics i got off the net. Id suggest we modify and use them. Here's the link.
http://dl.dropbox.com/u/10291175/pacman_gfx_starter_kit_968.rar
   
« Last Edit: September 17, 2011, 09:55:04 am by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #36 on: March 17, 2011, 07:31:03 pm »

I had not noticed, you updated the link for some pacman sprites,intil just now,
so I will try it in a minuete. I did these last night,....
This is the sprite sheet,...
http://dl.dropbox.com/u/15387474/newghost_blu.bmp
This is the animation
http://dl.dropbox.com/u/15387474/ghost2.gif
 What I am especially interested in, now is similar code, as before, but to load the animation,...Do I make sense ?...If that is not to much trouble,...
 
 If the sizes need to be changed, let me know.
from Garry
Report Spam   Logged

Guest
Guest
« Reply #37 on: March 19, 2011, 10:45:25 am »


    Here's an example of the new PacMan graphics. They are 40x40 and once decided the exact size they will be scaled to we will incorporate them. I was thinking of 20x20 but that may be too small. We may have to go a bigger window like 1200 x 800 and keep them as 40x40. Anyway here's a demo of them.
Code:
REM
DEFLNG A-Z

Sprites& = _LOADIMAGE("Pacmanss-2-40x40.bmp", 32)
Video& = _NEWIMAGE(640, 480, 32)
SCREEN Video&
GPlace = 1: gx = 320: gy = 10: GCycle = 0
PPlace = 1: px = 320: py = 100: PCycle = 0
DO
  _LIMIT 30
  GOSUB GMove
  GOSUB PMove
  CLS
  GCycle = GCycle + 1: IF GCycle = 3 THEN GCycle = 1
  PCycle = PCycle + 1: IF PCycle >= 4 THEN PCycle = 1
  'move ghost
  SELECT CASE GPlace
    CASE 1 '-----------------------------------------------------------------------------Face right
      IF GCycle = 1 THEN
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (82, 0)-(121, 39)
      ELSE
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (123, 0)-(162, 39)
      END IF
    CASE 2 '-----------------------------------------------------------------------------Face down
      IF GCycle = 1 THEN
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (246, 0)-(285, 39)
      ELSE
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (287, 0)-(326, 39)
      END IF
    CASE 3 '-----------------------------------------------------------------------------Face left
      IF GCycle = 1 THEN
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (0, 0)-(39, 39)
      ELSE
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (41, 0)-(80, 39)
      END IF
    CASE 4 '-----------------------------------------------------------------------------Face up
      IF GCycle = 1 THEN
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (164, 0)-(203, 39)
      ELSE
        _PUTIMAGE (gx, gy)-(gx + 39, gy + 39), Sprites&, Video&, (205, 0)-(244, 39)
      END IF
  END SELECT
  'move pac man
  SELECT CASE PPlace
    CASE 1
      IF PCycle = 1 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (164, 164)-(203, 203)
      IF PCycle = 2 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (205, 164)-(244, 203)
      IF PCycle = 3 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (246, 164)-(285, 203)
    CASE 2
      IF PCycle = 1 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (164, 164)-(203, 203)
      IF PCycle = 2 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (205, 164)-(244, 203)
      IF PCycle = 3 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (246, 164)-(285, 203)

    CASE 3
      IF PCycle = 1 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (203, 164)-(164, 203)
      IF PCycle = 2 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (244, 164)-(205, 203)
      IF PCycle = 3 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (285, 164)-(246, 203)
    CASE 4
      IF PCycle = 1 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (203, 164)-(164, 203)
      IF PCycle = 2 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (244, 164)-(205, 203)
      IF PCycle = 3 THEN _PUTIMAGE (px, py)-(px + 39, py + 39), Sprites&, Video&, (285, 164)-(246, 203)
  END SELECT
  _DISPLAY
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM

GMove:
SELECT CASE GPlace
  CASE 1
    gx = gx + 4
    IF gx >= 590 THEN gx = 590: GPlace = 2
  CASE 2
    gy = gy + 4
    IF gy >= 430 THEN gy = 430: GPlace = 3
  CASE 3
    gx = gx - 4
    IF gx <= 10 THEN gx = 10: GPlace = 4
  CASE 4
    gy = gy - 4
    IF gy <= 10 THEN gy = 10: GPlace = 1
END SELECT
RETURN

PMove:
SELECT CASE PPlace
  CASE 1
    px = px + 4
    IF px >= 540 THEN px = 540: PPlace = 2
  CASE 2
    py = py + 4
    IF py >= 380 THEN py = 380: PPlace = 3
  CASE 3
    px = px - 4
    IF px <= 100 THEN px = 100: PPlace = 4
  CASE 4
    py = py - 4
    IF py <= 100 THEN py = 100: PPlace = 1
END SELECT
RETURN
Here's the url to the image:http://dl.dropbox.com/u/10291175/PacManSS-2-40x40.rar


« Last Edit: September 17, 2011, 09:59:10 am by GarrisonRicketson » Report Spam   Logged
Dustie Bear
Full Member
***
Posts: 115


« Reply #38 on: March 19, 2011, 11:10:54 am »



Hi,

This is realy neat what you two are doing with pacman

May I make a suggestion.

Could you place the code in  the rar files with the pictures then we
dont have  to save the code then come back and DL the pics seperatly.

Just a thought, its ok the way your doing, Im just lazy I guess. LOL

Dustie

Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #39 on: March 19, 2011, 11:05:16 pm »

Oldoslover, those look good, the pac man and  the ghost,...since you already have these, no need to post them again, ....
  Guess thats about it, looking forward to seeing how these are put into the maze,...
from Garry
Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #40 on: March 27, 2011, 05:26:54 pm »

I made a maze useing the program olddoslover , and have been trying to get
the PacMan, and the ghosts,inside the maze, but no luck,
All I get is the maze loading as a bacground, The pac man moves around with the arrow keys, and the ghost, but they do not stay in the walls, they go right over or through them,..? I don't see any point in posting the code, because it dose not work right at all. Maybe I should,..sorry I have not been on much, I was out of town all of last week.
from Garry
Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #41 on: March 28, 2011, 08:59:31 am »

OK, I found a Demo, at petesqbasicsite, but for one it is for qb45, it is pretty neat,but it dose not include the entire source, the .bas can not be run by itself, but just looking at it, yes I can see it is going to take some time, it gets pretty complicated,...
thanks from Garry
Report Spam   Logged

guest
Guest
« Reply #42 on: April 03, 2011, 01:36:45 pm »


    Here's an update showing PacMan responding to key movement and correct facing direction.
Code:
REM Demo of Pac Map and PacMan movement.
DEFLNG A-Z

Graphics& = _LOADIMAGE("GMPacMan1.bmp", 32)
SCREEN _NEWIMAGE(800, 600, 32) 'what we see

DIM SHARED mx, my, mbl, mbr
DIM SHARED PacMap(19, 25)
DIM SHARED Pacrow, Paccol, Pacsym, N, S, E, W, NN, SS, EE, WW

Pacsym = 10: Pacrow = 1: Paccol = 7: Pacframe = 1: PacDir = 2 'east
GOSUB Filldim
GOSUB Placepac
'NOTE row and column start at 0


DO
  _LIMIT 15
  CLS
  GOSUB Showmap
  GOSUB Movpac
  LOCATE 33, 1: PRINT Pacrow, Paccol, N, E, S, W
  LOCATE 34, 1: PRINT NN, EE, SS, WW
  Pacframe = Pacframe + 1
  IF Pacframe >= 5 THEN Pacframe = 1
  _DISPLAY
LOOP UNTIL _KEYDOWN(27)
SLEEP
SCREEN 0
SYSTEM

Movpac:
'make a backup of PAC row and column
OlDPacrow = Pacrow: OldPaccol = Paccol

'we need to know what is above,below,to right and left for possible unblocked movement
'if any of NSEW is a limit on the map make it invalid as -1
N = Pacrow - 1
IF N < 0 THEN N = -1
S = Pacrow + 1
IF S > 18 THEN S = -1
E = Paccol + 1
IF E > 24 THEN E = -1
W = Paccol - 1
IF W < 0 THEN W = -1

'now if NSEW are valid see whats in those "cells"
IF N <> -1 THEN NN = PacMap(N, Paccol)
IF S <> -1 THEN SS = PacMap(S, Paccol)
IF E <> -1 THEN EE = PacMap(Pacrow, E)
IF W <> -1 THEN WW = PacMap(Pacrow, W)

IF _KEYDOWN(20480) THEN 'down arrow key
  IF SS <> 176 THEN 'test for wall
    IF S <> -1 THEN 'test for map limit
      Pacrow = Pacrow + 1
      PacDir = 3 'south
    END IF
  END IF
END IF

IF _KEYDOWN(18432) THEN 'up arrow key
  IF NN <> 176 THEN
    IF N <> -1 THEN
      Pacrow = Pacrow - 1
      PacDir = 1 'north
    END IF
  END IF
END IF

IF _KEYDOWN(19200) THEN 'left arrow key
  IF WW <> 176 THEN
    IF W <> -1 THEN
      Paccol = Paccol - 1
      PacDir = 4 'west
    END IF
  END IF
END IF

IF _KEYDOWN(19712) THEN 'right arrow key
  IF EE <> 176 THEN
    IF E <> -1 THEN
      Paccol = Paccol + 1
      PacDir = 2 'east
    END IF
  END IF
END IF
IF Pacrow <> OlDPacrow OR Paccol <> OldPaccol THEN
  'remove pac man from old position
  z = PacMap(OlDPacrow, OldPaccol) ''extract old pac man
  z = z - Pacsym ''suntract pacman symbol from it (42 -  10 = 32)
  PacMap(OlDPacrow, OldPaccol) = z ''place z  back inside map

  'add new pac to new position
  z = PacMap(Pacrow, Paccol) ''extract whats at this new row and column (should be 32)
  z = z + Pacsym ''add pacman symbol to it (32 +10 = 42)
  PacMap(Pacrow, Paccol) = z ''place in back inside map
END IF
RETURN

Showmap:
FOR c = 0 TO 18
  FOR R = 0 TO 24
    z = PacMap(c, R)
    SELECT CASE z
      CASE 32

      CASE 42
        SELECT CASE PacDir
          CASE 1 'N
            SELECT CASE Pacframe
              CASE 1
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (164, 285)-(203, 246)
              CASE 2
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (205, 285)-(244, 246)
              CASE 3
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (246, 285)-(285, 246)
              CASE 4
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (287, 285)-(326, 246)
            END SELECT
          CASE 2 'E
            SELECT CASE Pacframe
              CASE 1
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (0, 246)-(39, 285)
              CASE 2
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (41, 246)-(80, 285)
              CASE 3
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (82, 246)-(121, 285)
              CASE 4
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (123, 246)-(162, 285)
            END SELECT
          CASE 3 'S
            SELECT CASE Pacframe
              CASE 1
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (164, 246)-(203, 285)
              CASE 2
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (205, 246)-(244, 285)
              CASE 3
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (246, 246)-(285, 285)
              CASE 4
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (287, 246)-(326, 285)
            END SELECT
          CASE 4 'W
            SELECT CASE Pacframe
              CASE 1
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (39, 246)-(0, 285)
              CASE 2
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (80, 246)-(41, 285)
              CASE 3
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (121, 246)-(82, 285)
              CASE 4
                _PUTIMAGE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), Graphics&, 0, (162, 246)-(123, 285)
            END SELECT

        END SELECT
      CASE 176
        LINE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), _RGB32(0, 0, 255), BF
    END SELECT

  NEXT R
NEXT c

RETURN

Filldim:
FOR c = 0 TO 18
  FOR R = 0 TO 24
    READ z
    PacMap(c, R) = z
    'PacMap(r, c) = Z
    IF z = 176 THEN
      LINE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), _RGB32(0, 0, 255), BF
    END IF
  NEXT R
NEXT c
RETURN

Placepac:
'extract whats at this row and column (should be 32)
z = PacMap(Pacrow, Paccol)
'add pacman symbol to it (32 +10 = 42)
z = z + Pacsym
'place in back inside map
PacMap(Pacrow, Paccol) = z
RETURN



'-------------------------- MAP --------------------------------------
DATA 176,176,176,176,176,176,176,176,176,176,176,176,32,176,176,176,176,176,176,176,176,176,176,176,176
DATA 176,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,176
DATA 176,32,176,176,176,176,176,176,176,176,176,32,176,32,176,176,176,176,176,176,176,176,176,32,176
DATA 176,32,176,32,32,32,32,32,32,32,32,32,176,32,176,32,32,32,32,32,32,32,176,32,176
DATA 176,32,176,32,176,176,176,176,32,176,176,32,176,32,176,32,176,176,176,176,176,32,176,32,176
DATA 176,32,176,32,176,32,32,32,32,32,176,32,176,32,176,32,32,32,32,32,32,32,176,32,176
DATA 176,32,176,32,176,32,176,176,32,176,176,32,176,32,176,32,176,32,176,32,176,32,32,32,176
DATA 176,32,32,32,176,32,32,32,32,32,32,32,32,32,32,32,176,32,176,32,176,32,176,32,176
DATA 176,32,176,32,176,32,176,176,176,32,176,176,32,176,176,32,32,32,176,32,32,32,176,32,176
DATA 32,32,176,32,32,32,32,32,32,32,176,32,32,32,176,32,176,176,176,176,176,32,176,32,32
DATA 176,32,176,32,176,32,176,176,176,32,176,176,176,176,176,32,32,32,176,32,32,32,176,32,176
DATA 176,32,32,32,176,32,32,32,32,32,32,32,32,32,32,32,176,32,176,32,176,32,176,32,176
DATA 176,32,176,32,176,32,176,176,32,176,176,32,176,32,176,32,176,32,176,32,176,32,32,32,176
DATA 176,32,176,32,176,32,32,32,32,32,176,32,176,32,176,32,32,32,32,32,32,32,176,32,176
DATA 176,32,176,32,176,176,176,176,32,176,176,32,176,32,176,32,176,176,176,176,176,32,176,32,176
DATA 176,32,176,32,32,32,32,32,32,32,32,32,176,32,176,32,32,32,32,32,32,32,176,32,176
DATA 176,32,176,176,176,176,176,176,176,176,176,32,176,32,176,176,176,176,176,176,176,176,176,32,176
DATA 176,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,176
DATA 176,176,176,176,176,176,176,176,176,176,176,176,32,176,176,176,176,176,176,176,176,176,176,176,176

Heres the updated GRAPHIC:http://dl.dropbox.com/u/10291175/GMPacMan1.rar


« Last Edit: September 17, 2011, 10:03:38 am by GarrisonRicketson » Report Spam   Logged
guest
Guest
« Reply #43 on: April 03, 2011, 04:12:35 pm »


    Here's some thoughts on some Artificial Intelligence for our PacMan game.
Quote
      Ghost AI
   Ok we got four ghost's . How do we make some artificial intelligence? Ok we identify
them as numbers.
   1 = blue
   2 = red
   3 = yellow
   4 = pink
   Now elsewhere we defined direction as compass points. We will use the same idea for the
ghosts.
   N
   E
   S
   W
As far as a ghost is concerned as it travels it needs to probe these places
   Ahead
   To the right
   To the left
So if ghost is heading north the right is east and left is west. A ghost continues traveling
until it comes to an intersection. An intersection may be
   A dead end
   A one new direction
   A two new direction
   A three new direction
If we have only one choice we have to go that way.
If we reach a dead end then we have to reverse
If we reach a 2 way intersection then we roll a dice to decide new direction from the 2
choices.
If we reach a 3 way intersection then we roll a dice to decide new direction from the 3
choices.

   Now this is totally random. Its possible that being random the ghosts will never be
able to "track , corall, work in coordination , hunt". To do any of these behaviours we could
make the ghost when possible move toward the shortest direction of our hero some of the time.
In our maze will be dots that get eaten. If we had 100 dots and divided them by 10 we reach a
result of 10. Alternatively if we calculate the number of eaten dots and divide it by 10 we'd
get at present 0. So these two figures are inversely related. We use one of these derived
figures to generate a "chance" that the ghost uses our hero location to base their choice of
direction. If we used the eaten dots then its possible to make the ghosts hunt more as dots get
eaten.
   Lastly rather than generating each dice rolls that we need to use on the fly we could
create an array that holds a "weighted" amount of possible directions. In theory we have 3
directions to choose from at any moment. By arranging the numbers of direction as
1,2,3,1,2,3,1,2,3 and pre shuffle them then we simply read throught the array until we arrive
at a valid direction. As long as we note what subscript houses our valid number then we can
start at the next subscript the next time we need a new direction. Obviously we need to code
wrap around to arrive back at the start when we reach the end of the array. Also we can start
each ghost at different starting subscripts.
   When our hero eats a power pill then the ghosts must flee. We could use the same
arrangement of tracking to calculate the greates distance AWAY from our hero.
 

« Last Edit: September 17, 2011, 10:04:21 am by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #44 on: April 03, 2011, 06:13:37 pm »

Hi all,
    Here's an update showing PacMan responding to key movement and correct facing direction.

Heres the updated GRAPHIC:http://dl.dropbox.com/u/10291175/GMPacMan1.rar



This is pretty neat, , ...Glad to finaly see it,...On the Artificial inteligence, It sounds more complicated
Quote
this is totally random. Its possible that being random the ghosts will never be
able to "track , corall, work in coordination , hunt". To do any of these behaviours we could
make the ghost when possible move toward the shortest direction of our hero some of the time.
In the orginal,it is very noticable, that it seems like sometimes the ghosts seem to know where you are,...but I need to read your thoughts on the artificial intelligence , mor closely, to be able to say much.....I sure am glad to see some progress on this, sorry I have not been much help,...I am still looking for some sounds, like one for when the dots get eaten, another for if the ghost gets him and he dies, "doom", also a warning sound that goes off when the ghosts are about to go bcak to being able to attack,...
guess thats about it for now, thanks for posting this
from Garry
« Last Edit: September 09, 2011, 12:43:58 am by GarrisonRicketson » Report Spam   Logged


Pages: 1 2 [3] 4
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Buy traffic for your forum/website
traffic-masters
Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy