What should I use for large 2d games

Blitz3D Forums/Blitz3D Programming/What should I use for large 2d games

Chaosspear(Posted 2007) [#1]
I'm making a game like the first link and I want a BIG level but all I have for drawing is paint. What should I use for big levels?
thanks


slenkar(Posted 2007) [#2]
you create a floortile in paint and draw it over and over again on the screen(using blitz) (if you mean for a 2d game) to create the floor for the room.
you can use other art programs like photoshop,gimp,paintshop,project dogwaffle

then you create other tiles such as doors,
and draw objects like keys,
then create a mapeditor in blitz to place stuff in rooms and save the room as a data file.


Chaosspear(Posted 2007) [#3]
Thanks I was trying to put all the level in one bitmap file. too long!


LineOf7s(Posted 2007) [#4]
Tile Studio

Mappy

Two possibilities for you.


Chaosspear(Posted 2007) [#5]
Before I read LineOf7s' post I created my own Map Editor. I made it so that I would use a type to get the images into my game, but when I use this code in the game it says "memory access violation"
If Z=1
For nground.ground=Each ground
If frame=0
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y+6
Else
For nground.ground=Each ground
nground\Y=nground\Y-6
Next
EndIf
ElseIf frame=1
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y+6
nground\X=nground\X-6
Else
For nground.ground=Each ground
nground\Y=nground\Y-6
nground\X=nground\X+6
Next
EndIf
ElseIf frame=2
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\X=nground\X-6
Else
For nground.ground=Each ground
nground\X=nground\X+6
Next
EndIf
ElseIf frame=3
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
nground\X=nground\X-6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
nground\X=nground\X+6
Next
EndIf
ElseIf frame=4
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
Next
EndIf
ElseIf frame=5
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
nground\X=nground\X+6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
nground\X=nground\X-6
Next
EndIf
ElseIf frame=6
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\X=nground\X+6
Else
For nground.ground=Each ground
nground\X=nground\X-6
Next
EndIf
ElseIf frame=7
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\X=nground\X+6
nground\Y=nground\Y+6
Else
For nground.ground=Each ground
nground\Y=nground\Y-6
nground\X=nground\X-6
Next
EndIf
EndIf
Next
EndIf

why?


GfK(Posted 2007) [#6]
Turn Debug on.


Chaosspear(Posted 2007) [#7]
all ready is


slenkar(Posted 2007) [#8]
is the code above the whole program?

do you know how to use the debug window?
its best to create a window with a resolution less than your desktop;.
so if your desktop is 800x600 create a window in blitz that is 640x480
then you can see the debug window and use it.
also dont use fullscreen, until the bugs are gone.

instead of the above code you could use an array for the frames

e.g.
dim frames(7)

for x=1 to 7
for g.ground=each ground
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
nground\X=nground\X+6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
nground\X=nground\X-6
Next
EndIf
next
next


by the way, the reason you are getting an error is because you are using the same pointer to cycle through a list of types within a loop using the same pointer
e.g.
 
for nground.ground=each ground
for nground.ground=each ground
next
next

will give an error
but:
for n.ground=each ground
for g.ground=each ground
next
next

wont give you an error


Chaosspear(Posted 2007) [#9]
O sorry and since I don't plane to sell these you guys can have the codes. here is the code for the map editor
Graphics 640,480,32,2
SetBuffer BackBuffer()

tree=LoadImage("tree.bmp")
bush=LoadImage("bush.bmp")
grass=LoadImage("grass.bmp")
arrow=LoadImage("arrow.bmp")
ra=LoadImage("rightarrow.bmp")
la=LoadImage("leftarrow.bmp")
ua=LoadImage("uparrow.bmp")
da=LoadImage("downarrow.bmp")

dground=WriteFile("Data.dat")

CloseFile(dground)

ClsColor 0,200,0

Type image
	Field image,X,Y,itype,OX,OY
End Type

HidePointer()
While Not KeyDown(1)
Cls

If MouseHit(1)
If move=1
If ImagesCollide(ua,300,0,0,arrow,MouseX(),MouseY(),0)
BY=BY+5
ElseIf ImagesCollide(la,0,240,0,arrow,MouseX(),MouseY(),0)
BX=BX+5
ElseIf ImagesCollide(ra,610,240,0,arrow,MouseX(),MouseY(),0)
BX=BX-5
ElseIf ImagesCollide(da,300,440,0,arrow,MouseX(),MouseY(),0)
BY=BY-5
EndIf
EndIf
If ImagesCollide(tree,600,440,0,arrow,MouseX(),MouseY(),0)
something=1
ElseIf ImagesCollide(bush,0,440,0,arrow,MouseX(),MouseY(),0)
something=2
Else
If something>0 And MouseY()<400 And move=0
newimage.image=New image
If something=1
newimage\image=LoadImage("tree.bmp")
newimage\itype=1
newimage\X=MouseX()
newimage\Y=MouseY()
newimage\OX=newimage\X
newimage\OY=newimage\Y
ElseIf something=2
newimage\image=LoadImage("bush.bmp")
newimage\itype=2
newimage\X=MouseX()
newimage\Y=MouseY()
newimage\OX=newimage\X
newimage\OY=newimage\Y
EndIf
EndIf
EndIf
EndIf

If MouseHit(3)
If move=0
move=1
ElseIf move=1
move=0
EndIf
EndIf

For newimage.image=Each image
DrawImage newimage\image,BX+newimage\X,BY+newimage\Y
Next

Color 150,150,150
Rect 0,430,640,50
DrawImage ua,300,0
DrawImage la,0,240
DrawImage ra,610,240
DrawImage da,300,440
DrawImage tree,600,440
DrawImage bush,0,440
If something=0
DrawImage arrow,MouseX(),MouseY()
ElseIf something=1
DrawImage tree,MouseX(),MouseY()
ElseIf something=2
DrawImage bush,MouseX(),MouseY()
EndIf
If KeyDown(29) And KeyDown(31)
ground=OpenFile("Data.dat")
For newimage.image=Each image
WriteInt(ground,newimage\itype)
WriteInt(ground,newimage\X)
WriteInt(ground,newimage\Y)
Next
CloseFile(ground)
EndIf
Flip
Wend
End

and here is the game it's not nearly finished yet though
Graphics 800,600
AutoMidHandle True
SetBuffer BackBuffer()

profile1=LoadImage("programmer1 profile.bmp")
pointer=LoadImage("arrow.bmp")
ScaleImage pointer,.5,.7
newgame=LoadAnimImage("new game.bmp",75,16,0,2)
loadgame=LoadAnimImage("load game.bmp",90,16,0,2)
rise=LoadImage("the rise.bmp")
triseback=LoadImage("the rise back.bmp")

Type ground
	Field image,itype#,X,Y
End Type

groundimage=OpenFile("Data.dat")

While Not Eof(groundimage)
nground.ground=New ground
nground\itype#=ReadInt(groundimage)
nground\X=ReadInt(groundimage)
nground\Y=ReadInt(groundimage)
If nground\itype#=1
nground\image=LoadImage("tree.bmp")
ElseIf nground\itype#=2
nground\image=LoadImage("bush.bmp")
EndIf
Wend

Color 0,0,255
GX=300
GY=100

HidePointer

MoveMouse 400,300

.rechoose

While ngorlg=0
Cls

If KeyDown(1)
End
EndIf

If ImagesCollide(newgame,390,200,0,pointer,MouseX()+30,MouseY()+46,0)
what=1
FlushKeys()
If MouseHit(1)
ngorlg=1
EndIf
Else
what=0
EndIf
If ImagesCollide(loadgame,400,250,0,pointer,MouseX()+30,MouseY()+46,0)
what2=1
X=398
FlushKeys()
If MouseHit(1)
ngorlg=2
EndIf
Else
X=400
what2=0
EndIf

X2=X2+1

TileImage triseback,X2,0,0
TileImage rise,398,0
DrawImage newgame,390,200,what
DrawImage loadgame,X,245,what2
DrawImage pointer,MouseX()+30,MouseY()+46
If rchoose=1
Text 400,305,"No data files exist",True
EndIf
Flip
Wend

While ngorlg=1
Cls

If KeyHit(1)
End
EndIf

Locate 320,0
FlushKeys()

TileImage triseback,X2,0,0
TileImage rise,398,0

Color 0,0,0
If ImagesCollide(pointer,MouseX(),MouseY(),0,profile1,200,200,0)
If writ>=0*2 And writ<1*2
Write"B"
ElseIf writ>=1*2 And writ<2*2
Write"Bl"
ElseIf writ>=2*2 And writ<3*2
Write"Bli"
ElseIf writ>=3*2 And writ<4*2
Write"Blit"
ElseIf writ>=4*2 And writ<5*2
Write"Blitz"
ElseIf writ>=5*2 And writ<6*2
Write"Blitz "
ElseIf writ>=6*2 And writ<7*2
Write"Blitz B"
ElseIf writ>=7*2 And writ<8*2
Write"Blitz BA"
ElseIf writ>=8*2 And writ<9*2
Write"Blitz BAS"
ElseIf writ>=9*2 And writ<10*2
Write"Blitz BASI"
ElseIf writ>=10*2 And writ<11*2
Write"Blitz BASIC"
ElseIf writ>=11*2 And writ<12*2
Write"Blitz BASIC "
ElseIf writ>=12*2 And writ<13*2
Write"Blitz BASIC P"
ElseIf writ>=13*2 And writ<14*2
Write"Blitz BASIC Pr"
ElseIf writ>=14*2 And writ<15*2
Write"Blitz BASIC Pro"
ElseIf writ>=15*2 And writ<16*2
Write"Blitz BASIC Prog"
ElseIf writ>=16*2 And writ<17*2
Write"Blitz BASIC Progr"
ElseIf writ>=17*2 And writ<18*2
Write"Blitz BASIC Progra"
ElseIf writ>=18*2 And writ<19*2
Write"Blitz BASIC Program"
ElseIf writ>=19*2 And writ<20*2
Write"Blitz BASIC Programe"
ElseIf writ>=20*2
Write"Blitz BASIC Programer"
EndIf
writ=writ+1
FlushKeys()
If MouseHit(1)
person=LoadAnimImage("programmer1.bmp",43,46,0,3)
choose=1
EndIf
Else
writ=0
EndIf

FlushKeys()
If MouseX()>730 And MouseY()>540 And MouseHit(1) And choose=1
ngorlg=0
EndIf

X2=X2+1

Color 255,0,0
If choose=1
Text 400,475,"The Blitz BASIC programmer",True
EndIf
Text 400,450,"You have chosen",True
Text 730,540,"NEXT"
DrawImage profile1,200,200
DrawImage pointer,MouseX()+30,MouseY()+46
Flip
Wend

If ngorlg=2
;Number of files to check for program
files_count=3
Dim files$(files_count)

;Filenames
files$(1) = "GAME_01.DAT"
files$(2) = "GAME_02.DAT"
files$(3) = "GAME_03.DAT"

;Check files
For d = 1 To files_count
checkfile = FileType(files$(d))
If checkfile <> 1
ngorlg=0
rchoose=1
Goto rechoose
EndIf
Next
EndIf

While ngorlg=2

Flip
Wend

you=person

Const rotations = 8

Dim imagearray(rotations)

For frame=0 To rotations-1
	imagearray(frame) = CopyImage(you)
	RotateImage imagearray(frame), frame*360/rotations
Next

frame=0

ClsColor 0,200,0

ShowPointer()
While Not KeyDown(1)
Cls

If KeyDown(203)
frame=frame-1
If frame<0
frame=rotations - 1
EndIf
EndIf
If KeyDown(205)
frame=frame+1
If frame >= rotations
frame=0
EndIf
EndIf

If Not KeyDown(200) Or KeyDown(208)
position=0
EndIf

For nground.ground=Each ground
DrawImage nground\image,nground\X,nground\Y
Next

If KeyDown(200)
position=position+1
Z=1
Else
Z=0
EndIf

If Z=1
For nground.ground=Each ground
If frame=0
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y+6
Else
For nground.ground=Each ground
nground\Y=nground\Y-6
Next
EndIf
ElseIf frame=1
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y+6
nground\X=nground\X-6
Else
For nground.ground=Each ground
nground\Y=nground\Y-6
nground\X=nground\X+6
Next
EndIf
ElseIf frame=2
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\X=nground\X-6
Else
For nground.ground=Each ground
nground\X=nground\X+6
Next
EndIf
ElseIf frame=3
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
nground\X=nground\X-6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
nground\X=nground\X+6
Next
EndIf
ElseIf frame=4
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
Next
EndIf
ElseIf frame=5
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\Y=nground\Y-6
nground\X=nground\X+6
Else
For nground.ground=Each ground
nground\Y=nground\Y+6
nground\X=nground\X-6
Next
EndIf
ElseIf frame=6
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\X=nground\X+6
Else
For nground.ground=Each ground
nground\X=nground\X-6
Next
EndIf
ElseIf frame=7
If Not ImagesCollide(nground\image,nground\X,nground\Y,0,you,400,300,0)
nground\X=nground\X+6
nground\Y=nground\Y+6
Else
For nground.ground=Each ground
nground\Y=nground\Y-6
nground\X=nground\X-6
Next
EndIf
EndIf
Next
EndIf

If KeyDown(208)
position=position-1
If position=<0
position=3
EndIf
EndIf

DrawImage imagearray(frame),400,300,position Mod 3
Flip
Delay 75
Wend
End



slenkar(Posted 2007) [#10]
After having a quick look at your code I would say,

1.use Functions
especially for the bit that writes out 'blitz programmer'.

2.use XML for the map file format. do a search for blitz and XML to download the XML file reader that someone programmed.
also download microsofts XML file editor 'xml notepad'
3.use [codebox] instead of [code] on the forums


smilertoo(Posted 2007) [#11]
FishEd is very nice, and only £5.


Rob Farley(Posted 2007) [#12]
Without looking too deeply into your code...

May I suggest:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1229

Secondly the Blitz Programmer thing, take a look at the left function... You'll be able to say Write Left("Blitz Programmer",n)