View Single Post
Old 16 March 2017, 17:14   #26
Dan
Registered User
 
Dan's Avatar
 
Join Date: Nov 2004
Location: Germany
Posts: 629
Here is a Quick proof of concept, written in BlitzBasic for PC.


Code:
;====================================================================
; Project: Amiga Pod Proof of concept gameplay
; Version: 1.0
; Author: Dan
; Email: -
; Copyright:..PD
; Description: Written in Blitzbasic (PC) - www.blitzbasic.com
;              Open sourced basic language, free download at Homepage
;====================================================================

Graphics 640,480,32,2		;Opens the Graphic window, windowed mode 
Graphics 640,480,32,3		;And makes it resizeable

SetBuffer BackBuffer()

Dim Level(12,12)

Global PlayerX,PlayerY,PlayerOldX,PlayerOldY,PlayerMovingTimer

Read PlayerX
Read PlayerY

For y=1 To 12
	For x=1 To 12
		Read Level(x,y) 
	Next
Next

PlayerMovingTimer=MilliSecs()

Repeat
	
	If MilliSecs()-PlayerMovingTimer>80 Gosub moveplayer
		Gosub drawscreen
		Delay 170
		If GameOver=1 Then Color $ff,$ff,$ff : Text 320,240,"Game Over"
		Flip 0
	Until GameOver=1  ; End when esc is clicked
	
	Delay 2500
	WaitKey()
	
	End
	
	.drawscreen
	Cls 				;Clear the screen
	
	For y=1 To 12		;Loop to draw things on screen
		For x=1 To 12
			C=Level(x,y)
			If c=0 Then Color 0,0,0				;Black
			If c=1 Then Color 0,0,$ff			;Blue
			If c=2 Then Color 0,$ff,0			;Green
			If c=3 Then Color 0,$ff,$ff			;Cyan
			If c=4 Then Color $ff,0,0			;Red
			If c=5 Then Color $80,0,$80			;Purple
			Rect 80+(x*40),120+(y*20),40,20
			Color $0f,$0f,$0f
			Rect 80+(x*40),120+(y*20),40,20,0
			
			If x=PlayerX And y=PlayerY Then				;Draw Player Sprite (oval)
				Color $ff,$ff,$ff
				Oval 85+(x*40),122+(y*20),30,15
			EndIf
		Next
	Next
	
	Return
	
	.moveplayer
	
	FlushKeys()
	
	PlayerMovingTimer=MilliSecs()
	PlayerOldX=PlayerX
	PlayerOldY=PlayerY
	
	If PlayerX>1 And KeyDown(203)			; arrow key Left
		PlayerX=PlayerX-1
	EndIf
	
	If PlayerX<=11 And KeyDown(205)			; arrow key Right
		PlayerX=PlayerX+1
	EndIf
	
	If PlayerY>1 And KeyDown(200)			;arrow key UP
		PlayerY=PlayerY-1
	EndIf
	
	If PlayerY<=11 And KeyDown(208)			;arrow key Down
		PlayerY=PlayerY+1
	EndIf
	
	If (PlayerOldX<>PlayerX) Or (PlayerOldY<>PlayerY)
		
		If Level(PlayerX,PlayerY)=0 Then Gameover=1 ;Empty Tile
		
		Tilecheck=Level(PlayerOldX,PlayerOldY)
		
		If Tilecheck=>1 And Tilecheck<=3		;Blue,Green and Cyan
			Level(PlayerOldX,PlayerOldY)=Level(PlayerOldX,PlayerOldY)-1
		EndIf
		
	EndIf
	
	Return
	
	.level001
	Data 3,3		;Player starting position
;    1,2,3,4,5,6,7,8,9,10,11,12	-		level 01
	Data 0,0,0,0,0,0,0,0,0,0 ,0 ,0		;1
	Data 0,0,0,0,0,0,0,0,0,0 ,0 ,0		;2
	Data 0,0,2,0,0,0,0,0,0,0 ,0 ,0		;3
	Data 0,0,3,0,0,0,0,0,0,0 ,0 ,0		;4
	Data 0,0,3,0,0,0,0,0,0,0 ,0 ,0		;5
	Data 0,0,2,0,0,0,0,5,0,0 ,0 ,0		;6
	Data 0,0,1,0,0,0,0,3,0,0 ,0 ,0		;7
	Data 0,0,1,0,0,0,0,4,0,0 ,0 ,0		;8
	Data 0,0,1,2,3,3,3,4,0,0 ,0 ,0		;9
	Data 0,0,0,0,0,0,0,0,0,0 ,0 ,0		;10
	Data 0,0,0,0,0,0,0,0,0,0 ,0 ,0		;11
	Data 0,0,0,0,0,0,0,0,0,0 ,0 ,0		;12
Maybe someone want to convert the code to Amos Basic or AmiBlitz.

I never give a promise, so if i'm in a good mood at weekend, then ill try it with Amos.

Last edited by Dan; 16 March 2017 at 22:49.
Dan is offline  
 
Page generated in 0.04757 seconds with 11 queries