Hmm, after playing games like Bust-A-Move...

Miscellaneous Forums/General Discussion/Hmm, after playing games like Bust-A-Move...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

- Your artwork is atrocious and would have Atari 2600 coders sniggering behind your back.


Atari 2600? I was shooting for SNES, which I thought this was closer to. I believe that this was Miyamoto-inspired, and looks more like Gauntlet II or Zelda to me. Well, the original Gauntlet was made by Tengen/Atari, so you may have a point. Thought that this would've been a fancy version of the game that takes place in a Chinese Shaolin temple, with gongs and shruikens instead of paddles and a ball. Don't make me think of this as another failure. Guess that's how game design works in the Midwest instead of the Pacific coastline. I can see why Cleveland would never be a software design town. If only I were trained in Seattle, WA instead of Cleveland, OH. Grrr...

Well, then here's the code behind it:

; Main.bb - This is the main program segment featuring the game and keyboard functions
; (c)2006, RAM Digital Media, Robert A. Morin
; -----

; Set standard graphics resolution
Graphics 640,480

; Randomize the seed count generator
SeedRnd(MilliSecs())



; Game constants

; Keyboard Controls
Const UPKEY = 200
Const DOWNKEY = 208
Const PAUSEKEY = 25

; Object targets
Const PLAYERSPEED = 7
Const COMPUTERSPEED = 6

; Types and definitions

; Player type
Type player
	Field y,score
End Type

; Shruiken/starblade type
Type ball
	Field x,y,xv,yv
End Type

; Media files

; Audio
Global backmusic = LoadSound ("back.mid")
Global pingsound = LoadSound ("ping.wav")
Global gongsound = LoadSound ("gong.wav")
Global pausesound = LoadSound ("pause.wav")
Global pointsound = LoadSound ("point.wav")
Global gosound = LoadSound ("go.wav")
Global threesound = LoadSound ("three.wav")
Global twosound = LoadSound ("two.wav")
Global onesound = LoadSound ("one.wav")
Global gameoversound = LoadSound ("gameover.wav")

; Graphics
Global backimage = LoadImage ("ground.png")
Global playerimage = LoadImage ("gong1.png")
Global computerimage = LoadImage ("gong2.png")
Global starimage = LoadAnimImage ("star.png",32,32,0,2)
Global pauseimage = LoadImage ("pause.png")
Global threeimage = LoadImage ("three.png")
Global twoimage = LoadImage ("two.png")
Global oneimage = LoadImage ("one.png")
Global goimage = LoadImage ("go.png")
Global gameoverimage = LoadImage ("gameover.png")

; Type Initialization definitions
Global ball.ball = New ball
Global player1.player = New player
Global player2.player = New player

; Pregame initialization
DrawImage threeimage,0,0
PlaySound threesound
Delay(1000)
Cls

DrawImage twoimage,0,0
PlaySound twosound
Delay(1000)
Cls

DrawImage oneimage,0,0
PlaySound onesound
Delay(1000)
Cls

DrawImage goimage,0,0
PlaySound gosound
Delay(200)

; Default settings for buffer and central image handle
SetBuffer BackBuffer()
AutoMidHandle True

; Level initialization function
InitializeLevel()


; Initial score defaults
player1\score = 0
player2\score = 0

; Track rotation of shruiken
rotationcount = 0



; Main program loop
While Not KeyDown (1)

	Cls		; Clear screen
	
	; Draw background image
	DrawImage (backimage,0,0)
	
	; Draw shruiken starblade
	DrawImage (starimage,ball\x,ball\y,rotationcount Mod 2)
	
	; Rotation count track
	rotationcount = rotationcount + 1
	
	; Draw player gong
	DrawImage (playerimage,32,player1\y)
	
	; Draw computer gong
	DrawImage (computerimage,576,player2\y)
	
	; Keyboard test function
	TestKeyboard()
	
	; CPU AI function
	TestAI()
	
	; Score display function
	DrawScore()
	
	; Game Over function after 10 points has been reached 
	GameOver()
	
	Flip
	Delay 20
	
Wend
End

; Initialization of level function
Function InitializeLevel()

	; Centerize the shruiken in the middle of the screen
	ball\x = 320
	ball\y = 240

	; Randomize the direction the shruiken takes
	ball\xv = Rand(2,6)
	ball\yv = Rand(-8,8)

	; Place the gongs in the middle of their respective wood rails
	player2\y = 240
	player1\y = 240

End Function

; Once player reaches 10 points, end the game
Function GameOver()

	; Once player or CPU hits a score of 10, hit the Game Over screen
	If player1\score = 10
		Cls
		DrawImage gameoverimage,0,0
		PlaySound gameoversound
		Delay 3000
		End
		
	ElseIf player2\score = 10
		Cls
		DrawImage gameoverimage,0,0
		PlaySound gameoversound
		Delay 3000
		End
	EndIf
	
End Function

; Display the scores above the player location on the top of the screen
Function DrawScore()
	; Player score above player on top left
	Text 0,0,"PLAYER:\>  " + player1\score
	; Computer score above computer on top right
	Text 512,0, "COMPUTER:\>  " + player2\score
	; Display POINTS SCORED in top center
	Text 300,0, "POINTS SCORED"
	; Display game and company identification on bottom of screen
	Text 0,464, "SHAOLIN GONG - Version 1.0 Beta"
	Text 420,464, "(c)2006, RAM Digital Media, Robert A. Morin"
End Function

; Keyboard functions
Function TestKeyboard()

	; Move player gong up with Up Key
	If KeyDown (UPKEY)
		player1\y = player1\y - PLAYERSPEED
	EndIf
	
	; Move player gong down with Down Key
	If KeyDown (DOWNKEY)
		player1\y = player1\y + PLAYERSPEED
	EndIf
	
	; Restrain player from going too far beyond stone wall barrier
	If player1\y <= 32
		player1\y = 240
	ElseIf player1\y >= 448
		player1\y = 240
	EndIf
	
	; Pause game with P Key
	If KeyHit (PAUSEKEY)
		Cls		; Clear Screen
		
		; Display pause image, and play pause sound
		DrawImage pauseimage,0,0
		PlaySound pausesound
		
		Flip
		
		; Standby for player to press P again
		While Not KeyHit (PAUSEKEY)
		Wend
		
	EndIf
End Function

; CPU AI Functions
Function TestAI()

	; Move CPU paddle up when ball rises
	If ball\y > player2\y
		player2\y = player2\y + COMPUTERSPEED
	; Move CPU paddle down when ball lowers
	ElseIf ball\y < player2\y
		player2\y = player2\y - COMPUTERSPEED
	EndIf
	
	; Restrain CPU from going beyond stone wall barriers
	If player2\y <= 32
		player2\y = 240
	ElseIf player2\y >= 448
		player2\y = 240
	EndIf
	; Ball hits player gong, reflect, and sound gong
	If ImagesOverlap (starimage,ball\x,ball\y,playerimage,32,player1\y)
		ball\xv = -ball\xv + Rand(-4,4)
		ball\yv = ball\yv + Rand(-4,4)
		PlaySound gongsound
	; Ball hits computer gong, reflect, and sound gong
	ElseIf ImagesOverlap (starimage,ball\x,ball\y,computerimage,576,player2\y)
		ball\xv = -ball\xv + Rand(-4,4)
		ball\yv = ball\yv + Rand(-4,4)
		PlaySound gongsound
	; Ball hits north wall, ping the shot, and reflect it down
	ElseIf ball\y <= 64
		ball\yv = -ball\yv + Rand(-1,1)
		ball\xv = ball\xv + Rand(-1,1)
		PlaySound pingsound
		
	; The following restrains the shruiken from doing something goofy off screen
	ElseIf ball\y <= 32
		ball\x = 320
		ball\y = 240
	ElseIf ball\y >= 432
		ball\x = 320
		ball\y = 240
	ElseIf ball\x <= -16
		ball\x = 320
		ball\y = 240
	ElseIf ball\x >= 656
		ball\x = 320
		ball\y = 240
	
	; Ball hits south wall, ping the shot, and reflect it up
	ElseIf ball\y >= 408
		ball\yv = -ball\yv + Rand(-1,1)
		ball\xv = ball\xv + Rand(-1,1)
		PlaySound pingsound
	; Ball hits left wall, award CPU one point
	ElseIf ball\x <= 0
		player2\score = player2\score + 1
		Text 320,240, "POINT - Computer!"
		PlaySound pointsound
	
		Flip
		; Delay two seconds
		Delay(2000)
		
		; Reinitialize game
		InitializeLevel()
	; Ball hits right wall, award player one point
	ElseIf ball\x >= 640
		player1\score = player1\score + 1
		Text 320,240, "POINT - Player!"
		PlaySound pointsound
		Flip
		; Delay two seconds
		Delay(2000)
		; Reinitialize Level
		InitializeLevel()
	; Reset shruiken if it goes beyond stone wall barriers
	EndIf
	
	; Refresh and update ball position
	ball\x = ball\x + ball\xv
	ball\y = ball\y + ball\yv
End Function


Gotta add a title and epilogue to this later, and all that other presentation stuff for SNES-inspired games like this. So I got influences from playing Gauntlet II and Pong at the same time, and thought I'd blend a little of this, and a little of that. Thought I'd find a niche in hybrid game design, combining two arcade hits, and making one game with elements from famous game franchises, and thinking I'd do an original clone. Serves me right for having Shigeru Miyamoto AND Nolan Bushnell as a role model on this game.

Miyamoto meets Bushnell, east meets west, you get the point.