News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Platform type game , cops n robbers , complete

Started by micky4fun, August 25, 2009, 05:28:26 AM

Previous topic - Next topic

micky4fun

#15
Hi knieb

Thanks for your input ,
Quoteone bug i noticed is that some policemen carried money that you couldn't see
working late last night did no see that bug , but now fixed , just a counter reset will upload this later when ive done police interaction
QuoteI tried to get all the money i could and had 97 at the end, did i find everything?
looks like so as there is no ending to this demo yet , so no level complete yet
QuoteWhere will the cops bring the money when the player destroys all the banks?
good question , they may have to take money collected to police station or your bank or other bank , i seem to be making up the game rules as i go along at the moment
I would reduce the number of robbers and add some kind of waypoint AI
yes i may well do both of these
One suggestion for a bonus item: a gun with few shots to shoot policemen
yep did think of that , but see how game plays first

one other know bug is robber (you) gets stuck on left lift at top if you do not move off , will address this later

thanks again for your input , loved your first show case game pong666 , wonder whats in the pipeline now?

mick ;D

micky4fun

#16
Hi all

OOOOO dear , for some reason i have AVG virus protection on my p.c and it would not let me run Platbasic for 2 days , kept saying it had 2 trogens attached no matter what i did i could not get p.b to run , at last after 2 days of scanning and re-installing it still came up with the same problem , but tonight after a AVG update alls now ok , what a 2days

what a nightmare , any way back on track with game now

i hope to have a fully playable demo up by the weekend , i have now decided to have you the robber vs others type game , 2 main banks to put robbed money in , your and theirs , here is the 1st level now mapped out as it will be

mick ;D

kevin

Micky,

Quoteor some reason i have AVG virus protection on my p.c and it would not let me run Platbasic for 2 days , kept saying it had 2 trogens attached no matter what i did i could not get p.b to run

  What's his PlatBasic you speak of ? :)  -  Anyway, I've been testing this a bit today.. A-squared doesn't seem like anything built with 1.64j  .  After a little investigation, seems that it just doesn't like some of libs.  But after some tinkering it's no longer bothered,  so it's probably a false positive, but just to be on the safe side i'm going re-build and re-release 1.64J.     


  The game looks like it's really coming along, but surely you could think of something better to name it than  demo.bmp



micky4fun

Hi Kevin

yes its v1.64j i was having trouble with , but as i re-installed from scratch and updated each one as i went along then tested each one as i went  , i cant remember exactly but 1 or 2 updates before release 1.64j AVG said it had a trojan , but after an AVG update it all seems ok now , ive been using 1.64j for a while before all this happened and it work ok then with no problems

mick :)

LemonWizard

It's been a while since I've been on here... still waiting for that contest to start =p
nice work Micky.
if I had more time on my hands I'd be working on a high quality long term project

micky4fun

#20
Hi LemonWizard

Thanks for coments on game ,
Quoteif I had more time on my hands I'd be working on a high quality long term project
well ive been fairly lucky getting quite a bit of time at mo to do things , but as i am still learning i like to do just small stuff just to get use to things ,
before buying PlayBasic the only thing i ever programed years ago was a simple for a=1 to 100 , print "hello" , next a and that was it
so im pretty pleased with myself so far , will in time do a long project , just got to get my code tidier , just cant seem to do that yet ,

ok heres a playable demo of first level divided into 4 levels , ie 1.1 , 1.2 , 1.3 1nd 1.4 once these are complete then entirly new level 2 with 4 levels in that to

ok you have to rob banks , then take money to your bank ( green bank ) you can rob by-standers as long as you are not carring any money , you can carry a max of 5 bags , by-standers can only carry upto 3 bags , you can get 3 bags off of by-standers and still pick up 2 others off of floor ,
once you got your bags dont get caught by police as they will take bags off of you and return it to there bank ( red bank )
also by-standers will take thier bags to red bank , you must end up with more bags in your bank than they have in thiers to continue level

in full game there will be a timer as well , and a score at top of screen as well , so you will score as you go along

any comments welcome , at mo its running at 70fps window mode , but can run upto 180 on my p.c

mick :)

still lots to do just a few more screenies

micky4fun

#21
Hi all

ok , i here it maybe compo time very soon , so ile post completed stages 1 to 4 of my game , no sound yet that will be added over the next day or two , then im off on holiday for a week to NewYork

i will leave game on hold until compo is over as i will concertrate on compo , looks like its going to be a very interesting one , seems there might be a good few entries

use arrow keys or joystick to controll , your green bank is where you have to take bags collected , its open till 17.30

any comments welcome

mick :)

ps , sound now added , will post tomorrow as to late now  , i know there is a bit where if a other player has money for you to steal off of them and theres 2 or more together you dont always get it off of them , this is because im only dectecting one sprite and not using getnextsprite yet , may or maynot do this in full game

mick ;D

micky4fun

#22
Hi all

ok heres the game and code with sound for the first 4 levels of game , i will continue with levels 5-8 which will be a new map when i can , proberly after compo.. , still a few very minor bugs to be addressed later ..

download here
bankjob1.1.zip (login required)


mick :)

markel422

For some reason I am having trouble loading the game, even loading it in Playbasic.  :(

As well as get an error that says: "Error in<Main.pba>,230:Fatal Error-Map Block Gfx File 'ooo2.png' Does Not Exist.

???

kevin

markel422,

    The error probably occurs because Mick is using a much newer version of Playbasic which supports loading PNG images directly in as a Map.  Older versions don't support this and will no doubt spit out an error.  Which is what i suspect is happening in your case.

    replacing this line,


LoadMapGFX "ooo2.png",MyMap,32,24,RGB(0,0,0)


  With this should resolve the problem


  tempIMage=LoadNewIMage("ooo2.png")
  MakeMapGFX MyMap,TempImage,32,24,1000,RGB(0,0,0)
  deleteimage TempImage 




Mick,

    This has really come along.  Very well done!  -  A little tip though, externalize the levels.  Then you can get others to help out.     


micky4fun

#25
Hi Kevin

QuoteThis has really come along.  Very well done!  -  A little tip though, externalize the levels.  Then you can get others to help out.
yep ive been on here exactly a year now , and im very pleased with what i have managed to learn and do in that time , had loads of help from yourself and others , BlinkOk and u9 to mension a few , i think the key was to do a small project , something within my capablebility but pushing me a bit at the same time..


will do one more main map so 4 more levels on this as still loads of other stuff i want to try out , proberly rubbish but there maybe one or two that turns out ok
but just the fun in doing it makes it for me ,

ok not seeming to thick how would i go about externalizing the levels with my code ?

thanks
mick

kevin


The short answer is via the File commands.  How to store the information is up to you, but generally it's worth putting a little be extra effort into the how the file is arranged,  so the level creating is easier and the program has some error checking..

  I'll knock up an example in a minute

kevin

#27
   Here's a sample level map loader.  

PlayBASIC Code: [Select]
      path$="Some place on your hard disc\bank_job\"

Map=NewMap(1)

LoadMapGFX path$+"gfx\ooo2.png",Map,32,24,RGB(0,0,0)

Width=25
Height=50

Level=LoadLevelToMap(Path$+"Level1.txt",Map, Width,Height)

print Map
print Level

drawMap Map,Level,0,0
drawMap Map,Level,0,-600

Sync
waitkey


Function LoadLevelToMap(Filename$,ThisMap, Width,Height)

if FileExist(Filename$)

Level=NewLevel(ThisMap,Width,Height)

LevelTransparent ThisMap,Level,0


Dim TileRow(Width)

File=ReadNewFile(FileName$)


while Not EndOFFile(File)

// read a line of text from this file
LineOFText$=ReadString$(File)

// remove any spaces or tabs from the head of this line
LIneOftext$=trim$(LineOFText$," "+chr$(9))

// Skip blank lines of text
if LIneOftext$="" then continue

// check if this row is a comment ? if it is, then we skip this and continue the While Loop
// in here the person editing the levels can add comments if they wanted
if Left$(LineOfTExt$,1)=";" then continue

// If this line isn't a comment, then it must a row of Map Tiles
TilesFound=SplittoArray(lineOfText$,",", TileRow(),1)
if TilesFound=Width

if TileYpos<Height

for Rowlp=1 to TilesFound
PokeLevelTIle ThisMap,Level,RowLp-1,TileYpos,TileRow(RowLp)
next

inc TileYpos

else

print "Error-->>Too many rows in this level...."
endif

else
print lineOfText$
print "Error->> this row only has "+str$(TilesFound)+" Tiles, epxecting "+str$(Width)


endif
endwhile

closefile file

endif
EndFunction Level






Here's the Level1.txt-  it's just the data statements cut and pasted and saved as text file  


;----------------- level one map --------------------
 8,3,2,1,0,0,0,0,0,1,2,2,2,2,2,2,0,0,0,0,0,1,1,3,8
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,6,1,1,2,1,1,2,1,1,1,1,1,1,1,1,2,2,1,1,2,9,0,7
 6,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,7
 7,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,7
 7,0,2,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,3,0,7
 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6
 7,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 6,0,2,1,2,1,2,1,2,1,2,1,0,1,1,1,1,1,1,1,1,1,1,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,6
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,1,2,1,2,3,3,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 8,0,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,0,7
 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8
 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7
 7,7,8,8,7,7,7,7,6,7,7,7,6,6,7,7,7,6,7,7,8,7,7,7,7

micky4fun

Hi Kevin

Thanks for code , but this line has a error
Quoteif LineOfTExt$,1)="" then continue
i did change it to
Quoteif LineOfTExt$ = "" then continue
but that through up a level 0 does not exist in this map error
can you advise me ,,

thanks mick

kevin


Quotei did change it to

   ta,  I added the line when posting the sample.  It was tested and working as expected here.  Did you save the level data as a text file on your machine ? -   You'll need to tell it where those files are also.  Actually, perhaps you should post your usage of the function.