Test

Blitz3D Forums/Blitz3D Beginners Area/Test

heletrobe(Posted 2013) [#1]
Test


heletrobe(Posted 2013) [#2]
Test


_PJ_(Posted 2013) [#3]
Hi heletrobe,

For future reference use {code} and {/code} but with square brackets [ ] to preserve your code formatting in the forums.
That gives the
Nice green on black appearance too


Alternatively, you can use {codebox} and {/codebox} if you have a particularly long code sample and need to keep the size of the post down.

Anyhoo, about your question:
If readmap=1 Then Read map(10,10)
DrawImage tileset,x*40,y*40,map(10,10)


Because the value at (10,10) which is cell 11x11 never gets populated (arrays are always start from 0 ... n ) and every tile drawn will be '0' (grass)

Try this instead:

Graphics 800,600,0,2
SetBuffer BackBuffer()
AutoMidHandle True
AppTitle "RPG TEST"

Global mapx=9
Global mapy=9

Dim map(mapx,mapy)
Data 0,0,1,0,0,0,0,0,1,0
Data 0,0,1,0,0,0,0,0,1,0
Data 0,0,1,0,0,0,0,0,1,0
Data 0,0,1,0,0,0,0,0,1,0
Data 0,0,1,1,1,1,1,1,1,1
Data 0,0,1,0,0,0,0,0,0,0
Data 0,0,1,0,0,2,2,0,0,0
Data 0,0,1,0,0,2,2,0,0,0
Data 0,0,1,0,0,0,0,0,0,0
Data 0,0,1,0,0,0,0,0,0,0

playerx=80
playery=80
Global readmap=True
Global tileset=LoadAnimImage("tileset.png",40,40,0,3)
player=CreateImageLoadImage("player.png")

While Not KeyDown(1)

Cls

MaskImage player,255,255,255
DrawImage player,40+(playerx),playery

If KeyDown(205) Then playerx=playerx+1
If KeyDown(203) Then playerx=playerx-1

loadworld()

Flip

Wend

End

Function loadworld()

For y=0 To mapy
	For x=0 To mapx
	
		If (readmap) Then 
			Read map(y,x)
		End If
		
	DrawImage tileset,40+(x*40),y*40,map(y,x)

	Next
Next

readmap=False

End Function 



heletrobe(Posted 2013) [#4]
Test


heletrobe(Posted 2013) [#5]
Hey i have another question, its working fine but the player appears under the map. How do i get him to appear above the map?
If it matters the tiles and player are 40X40 Pixels each


xlsior(Posted 2013) [#6]
Hey i have another question, its working fine but the player appears under the map. How do i get him to appear above the map?


First draw the map, then draw your player -- it will then be drawn on top of the map.


heletrobe(Posted 2013) [#7]
Test


Kryzon(Posted 2013) [#8]
The ordering that you use to draw your images is often known as "Z-ordering."

You can find out more about it here (Search for the "Z-Ordering" article):
http://www.krylarskreations.com/bc/


cryptadone(Posted 2014) [#9]
no put the maskimage in the doloop...