Weekly Qbasic and Qb64 Lesson Topics
April 27, 2018, 03:32:41 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 2946 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #15 on: March 02, 2011, 11:58:07 pm »

I got a little side tracked tonight, but did look at these,..and tried them,
On the map maker ( editor ) I am haveing soem trouble, with it fitting onmy screen. It dose work, though,...usually for me , if I use alt-enter, to get full screen, the program, then fits in my screen, the trouble is when I did this, on this, I lose my mouse, arrow, so I can't see where the mouse is, only by the pixel coordinates, that are shown, on the upper right, I can tell where it is.
 It is real late and I am tired,..I am thinking I could change
Quote
SCREEN _NEWIMAGE(800, 600, 32) 'what we see
to a smaller size, ?
I may just try that now before I go to sleep.
from Garry
Note,..just changeing this, didn't work. Also,the mouse dissapearing if I use
full screen, Any ideas ? This did not occur with the 1st "best version yet "
map maker,...before you had the text file saver.
But it dose work fine as far as creating both the :bmp and txt file , and saveing them.
form Garry
« Last Edit: March 04, 2011, 07:56:46 am by GarrisonRicketson » Report Spam   Logged

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



WWW
« Reply #16 on: March 04, 2011, 07:43:16 pm »

Ok, I added   _MOUSESHOW above the DO line and it now works fine useing
full screen,  Note: MOUSESHOW by itself gets a syntex error message, it need the _MOUSESHOW, I was able to guess that, as many or most of the new, keywords, and comands start with the _KEYWORD
thanks from Garry
Report Spam   Logged

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



WWW
« Reply #17 on: March 06, 2011, 02:21:50 pm »

Hi all,
    Say hello to our NEW PROJECT Garry. Together we will make this a good game. Round up some midi music for us please!
OlDosLover.

I did some searches, for midi sound affects, or music, and allthough I found lots of stuff, nothing that I really like. I am working on something, now,
 First will be a background sort of "theme", and then separate, some sounds, useing orchresta effects (horns,bass,etc), that will be for when PacMan eats a enemy (ghost), ...when I have them ready I will post the samples....Also I am thinking about some thing to go with the catch the bunny game, but that will get posted, there,...separate.
From Garry
posted,
Report Spam   Logged

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



WWW
« Reply #18 on: March 06, 2011, 08:46:35 pm »

Here is one midi, I like it, I let it play, at the same time as I had the PacyMan.bas running, it could be the ,"background music", if yu like it,
I do, but every one has theyre own tastes,...the only problem for me is I don't know how to put it in so it plays, while the program runs.
This is the a link to the post, with the code sample you made: which is what I am useing:
http://weeklyqbasicandqb64lesson.smfforfree.com/index.php/topic,35.msg147.html#msg147
And here is the midi.

http://dl.dropbox.com/u/15387474/PacMan2.rar
If you prefer, post the sample in "my experiment"
If you have time, and thanks, hope you like it. I will work on some others, short,"bursts", for like when a enemy is "eaten", and or the  dots, ( I think for the dots, either a short "chirp",or beep,) I'll post a sample, later.
from Gary
P.S. if we do this right, we could come up with something where people can put in theyre own "background music or sounds", customize so to speak,
in my case, after awhile I get bored, with always the same sounds, evry time I play a game,...I say we, but you are doing most ogf the hardest part
with the code!....
from Garry
edit : sorry I thought I had changed this to .rar, now I did
« Last Edit: March 07, 2011, 07:21:01 pm by GarrisonRicketson » Report Spam   Logged

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



WWW
« Reply #19 on: March 06, 2011, 10:02:54 pm »

ok, it will just be a few minuets, I just got back
frm Garry
Here it is zipped:
http://dl.dropbox.com/u/15387474/PacMan2.rar
from Garry
« Last Edit: March 06, 2011, 10:07:34 pm by GarrisonRicketson » Report Spam   Logged

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



WWW
« Reply #20 on: March 07, 2011, 11:52:35 pm »

Hello, Here is 3 more midis, in a zipped RAR folder, these could be used in this,
or in "My experiment" Whichever one you like,

http://dl.dropbox.com/u/15387474/midis.rar
from Garry
Report Spam   Logged

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



WWW
« Reply #21 on: March 08, 2011, 01:08:59 am »

Ok, good,
 I had been trying to get some other programs, to play the midi,...
and although it plays, it dose not play the entire time the prgram runs,...just once, and then it stops....So I thin I need some help in the correct way, to place   
Code:
   mid1& = _SNDOPEN("hi_hat.mid", "vol")
    _SNDVOL mid1&, 0.7
    _SNDPLAY mid1& 
 
in a program, all though it worked in "my experiment", in others no go. Maybe tommorow, I am real tired now...
from Garry
Report Spam   Logged

guest
Guest
« Reply #22 on: March 08, 2011, 01:22:23 am »


    You have to poll for soundplaying.

The _SNDPLAYING function returns whether a sound is being played. Uses a handle from the _SNDOPEN or _SNDCOPY functions.

Syntax:
playing% = _SNDPLAYING (handle&)

Description:
Returns 0 if a sound is not playing or -1 if it is.
If a sound is paused, _SNDPLAYING will return 0.

So if you compose a loop and have a place inside that loop that checks if sound is playing then if the sound stops soundplaying returns a zero so based off that zero you branch to load and play the sound again.

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



WWW
« Reply #23 on: March 08, 2011, 01:44:39 am »



    You have to poll for soundplaying.

The _SNDPLAYING function returns whether a sound is being played. Uses a handle from the _SNDOPEN or _SNDCOPY functions.

Syntax:
playing% = _SNDPLAYING (handle&)

Description:
Returns 0 if a sound is not playing or -1 if it is.
If a sound is paused, _SNDPLAYING will return 0.


Code:
         '-----------------------------------------------------code for sound
volume = 1 '                                               full volume
gamestart = False '                                        no game yet
intromusic = _SNDOPEN("munchies.mid", "VOL") '           open intro music
_SNDVOL intromusic, volume '                               set music volume
_SNDLOOP intromusic '
PRINT "This is my Music"           
OK, This works too, my error was not includeing the _soundloop , that is why it was only playing once, the other thing, the high_hat.mid  has a real long space of silence, in the middle, one may think it is not going to continue, but it dose. I did not write the 3 I just posted.
 I tried the munchies.mid with UnseensGDK, "Garrysgame"(catch the bunny)
It worked, but I did not have the _sndloop  in it so it did not keep playing continuesly.
 So if you compose a loop and have a place inside that loop that checks if sound is playing then if the sound stops soundplaying returns a zero so based off that zero you branch to load and play the sound again.  This makes sense, and explains why I could not put the sound inside the main loop. It is hard when I am so tired, well I will "dream" on this,
I think I understand better.
Thanks and see you later
from Garry
« Last Edit: September 17, 2011, 09:45:43 am by GarrisonRicketson » Report Spam   Logged

guest
Guest
« Reply #24 on: March 08, 2011, 01:53:10 am »


Code:
REM
DEFLNG A-Z

CHDIR "c:\windows\media\" 'xp files reside here or put file in qb64 main folder
mid1& = _SNDOPEN("hi_hat.mid", "vol")
_SNDVOL mid1&, 0.7

SCREEN 12

DO
  _LIMIT 100
  x1 = INT(RND * 600) + 20
  y1 = INT(RND * 400) + 20
  r = INT(RND * 10) + 1
  tint = INT(RND * 15) + 1
  PSET (x1, y1), tint
  CIRCLE (x1, y1), r, tint
  IF NOT _SNDPLAYING(mid1&) THEN
    _SNDPLAY mid1&
  END IF
  IF _KEYDOWN(27) THEN
    EXIT DO
  END IF
  _DISPLAY
LOOP
_SNDSTOP mid1&
_SNDCLOSE mid1&
SLEEP
SYSTEM
« Last Edit: September 17, 2011, 09:46:40 am by GarrisonRicketson » Report Spam   Logged
Jim Tester
Guest
« Reply #25 on: March 09, 2011, 10:24:45 pm »

I am going to make a enemy (ghost), if I use 54 x 54 pixels , for the sprite,
is that correct .
Here it is, Sorry I forgot to zip it, I am not thinking very clearly tonight.
http://dl.dropbox.com/u/15387474/Ghost.bmp
From Garry ( Jim tester )
« Last Edit: March 09, 2011, 11:13:38 pm by GarrisonRicketson » Report Spam   Logged
guest
Guest
« Reply #26 on: March 10, 2011, 04:15:36 pm »


    Here is an update that alows movement off the arrow keys. This is more a demonstration or proof of concept. This wont be the final version.
Code:
REM Demo of Pac Map.
DEFLNG A-Z

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
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
  _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
    END IF
  END IF
END IF

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

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

IF _KEYDOWN(19712) THEN 'right arrow key
  IF EE <> 176 THEN
    IF E <> -1 THEN
      Paccol = Paccol + 1
    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
        LINE (R * 30, c * 30)-((R * 30) + 29, (c * 30) + 29), _RGB32(255, 255, 0), BF
      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

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



WWW
« Reply #27 on: March 10, 2011, 06:54:10 pm »

Quote
      Hi all,
    Garry we need:
1] PacMan crunch sound (eat dot)
2] Pac Man eat ghost sound
3] Ghost attack sound
4] Pac Man die sound
5] Background music.
   The ghost graphics can be 40 x 40 as we will scale them down. I think my Pac Man is 30 x 30.
OlDosLover.

Ok, in response, to your Pm,yes this better, as the reader, can look at the previous posts, if neccesary, while posting,...
Ok on the sounds,...
Quote
1] Each graphic be 20 pixels by 20 pixels in size.
This is the size on the screen ? 
1.---The ghosts, Ok on 40 x 40  the sample had been 54 x 54 , and is saved as 256 bmp, is 256 ok ?, or please advise,...
2. screen resolution 800x600, ok with me,
3...ok
4.___My feelings on the levels,  3 to start, this  depends much on you,...the original, game is something like 35 levels....but that is a lot of work, I think with 3 levels, one would have a pretty good idea, as to how to create and add more if they wish, or dose this need to be decided at the beginning ? If so, can it be started, with the plan to eventually have 25 levels, but run ok, with just 2 or 3, to start ? Do I make sense ?
5.___oops sorry, ..then 25 total, possible,...and I think 3 unique, layouts,
6. Perhaps, can we make that optional,...on the lives ? 5 being the max ?
The orginal has 4, pills, guess that could be the same 4,..on the rewards, need to think a litle more, , also the score, bombs is a new "twist",...What about, 3 "bombs", or like in the SMEGABUG (terry Richies) wormholes, with the bomb, pacman can "blast! a hole, in the wall of the maze, to escape the ghosts, if that is possible or not too complicated, in the original, I always found it very frustrateing, when the ghosts "trap" me, it would be nice to have a "bomb", so I could blast a hole in the wall, and escape.....
Ok guess, thats about it for now,... PS:I tried this
Quote
Hi all,
    Here is an update that alows movement off the arrow keys. This is more a demonstration or proof of concept. This wont be the final version.
Looks good,....I saved it as Pacmanstage2.bas
from Garry
Report Spam   Logged

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



WWW
« Reply #28 on: March 10, 2011, 08:24:58 pm »

Quote
Final sprite sheet will be 32 bit with 20 x 20 sptites.
I was just looking, my version  of MS paint dose not show a option for 32 bit
24 bit, 16colors, 256colors, monochrome, png ,jpeg,tiff,Gif, is all the options ?
Is 24bit ok, I just checked paintshop pro, and it is bacsicly the same ?
From Garry
Edit: I did a google, on mspaint 32 bit, Are you useing windows 7 ?...but it also
looks like there is a way to upgrade mine,...
from Garry
« Last Edit: March 10, 2011, 08:49:57 pm by GarrisonRicketson » Report Spam   Logged

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



WWW
« Reply #29 on: March 11, 2011, 12:15:00 am »

Ok, thats good.
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