Style Jezzball game

Blitz3D Forums/Blitz3D Beginners Area/Style Jezzball game

Had to look it up, but Jezzball is like a Microsoft version of Qix.

The object of the game is to paint/fill 75% of the game screen with out being touched by the Jezzball(MS) or the Spark(Qix).

The clearest description of the game is here:
http://takegame.com/arcade/htm/jezzball.htm

@Insane Games
The original Jezzball was a 28x20 grid of squares. So make an array: grid(28,20) which are all zeroes at the beginning of a game.

Draw a square 28x28 pixels in your favorite color. This ensures that the playfield will fit on a 800x600 res screen. Use the "GrabImage" command to store the square as an image in memory.

You have to scale the MouseX() and MouseY() coords to work with the grid() and to draw images on the screen.

When the player left clicks (horizontal lines) divide the MouseX() and MouseY() locations by 28, use only the whole number result. These whole number results tell where to begin drawing your squares. Use these whole numbers as a basis for filling the grid(array) and drawing images on the screen.

The code below is NOT complete, if I did it all for you what fun would that be? There should be enough code to get you started.

By the way, I don't speak Portuguese, but it's close enough to Spanish to understand your code.

Hope this helps,

Andy


sizeX% = 28 ;width of playfield
sizeY% = 20 ;height of playfield
square = 28 ;width and height of THE square

minX% =  0
maxX% =  sizeX * square

minY% = 0
maxY% = sizeY * square

speed = 100 ;delay in milliseconds

Dim grid%(sizeX, sizeY)

Graphics 800,600,0,2
SetBuffer BackBuffer()


Cls
;We're drawing an image to copy here
Color 255,0,255
Rect 0,0,28,28,True
Color 255,0,0
Oval 0,0,28,28,True
Color 255,255,255
Line 14,0,14,28
Line 15,0,15,28
Line 13,0,13,27
Line 16,1,16,27
Flip
gfxSqr% = CreateImage(square,square)
GrabImage(gfxSqr,0,0)
MaskImage gfxSqr, 255,0,255

Cls
Flip

;main loop
While KeyHit(1) = 0

	If MouseHit(1)=True Then
		mx% = MouseX() ;store in mx to lock x position
		my% = MouseY() ;store in my to lock y position
		x% = Floor(mx/square)  ; x is x position in grid(array) and screen
		y% = Floor(my/square)  ; y is y position in grid(array) and screen

		;Calculate the longest x-line segment
		deltaX = sizeX - x
		If x > deltaX Then deltaX = x

		;Draw a square at current position
		currentPosX = x * square
		currentPosY = y * square
		DrawImage(gfxSqr, currentPosX, currentPosY)
		;Draw horizontal lines from current position
		xR% = x
		xL% = x
		For i = 1 To deltaX
			xR% = xR+1
			xL% = xL-1
			If xR <= sizeX-1 Then
				goRight = xR * square
					DrawImage(gfxSqr, goRight, currentPosY)
			End If
	
			If xL >= minX Then
				goLeft = xL * square
				DrawImage(gfxSqr, goLeft, currentPosY)
			End If
			Delay speed
			Flip
		Next
	End If

	If MouseHit(2)=True Then

		mx% = MouseX() ;store in mx to lock x position
		my% = MouseY() ;store in my to lock y position
		x% = Floor(mx/square)  ; x will equal 14
		y% = Floor(my/square)  ; y will equal 10

		;Calculate the longest y-line segment
		deltaY = sizeY - y
		If y > deltaY Then deltaY = y

		;Draw a square at current position
		currentPosX = x * square
		currentPosY = y * square
		DrawImage(gfxSqr, currentPosX, currentPosY)

		;Draw vertical lines from current position
		yD = y
		yU = y
		For i% = 1 To deltaY
			yD = yD+1
			yU = yU-1
			If yD <= sizeY Then
				goDown = yD * square
				DrawImage(gfxSqr, currentPosX, goDown)
			End If
	
			If yU >= minY Then
				goUp = yU * square
				DrawImage(gfxSqr, currentPosX, goUp)
			End If
			Delay speed

			Flip
		Next
	End If

Wend

FreeImage(gfxSqr)

End