Hic Huntin'

BlitzPlus Forums/BlitzPlus Programming/Hic Huntin'

I'm making a game called Hick Huntin'. It's where you're a hick out hunting. I need help on how to get the animals in. I have a horse and a dog I need to put in. The source is below:

Graphics 1024,768,32
SetBuffer BackBuffer()
AppTitle"Hick Hunting"

main = LoadImage("gfx/main.bmp")

While Not KeyDown(57)
Cls

If KeyHit(28) Then Goto start

DrawImage main,0,0

Flip
Wend

.start
Graphics 1024,768,32
SetBuffer BackBuffer()
AppTitle"Hic Hunting"

forestimage = LoadImage("gfx/forest.bmp")
cloudsimage = LoadImage("gfx/clouds.bmp")
treesimage = LoadImage("gfx/trees.bmp")
pistol = LoadAnimImage("gfx/pistol.bmp",300,300,0,2)
aimimage = LoadImage("gfx/aim.bmp")
dotimage = LoadImage("gfx/dot.bmp")
Global treehitimage = LoadAnimImage("gfx/tree hit.bmp",30,30,0,10)
Global barkhitimage = LoadImage("gfx/barkhit.bmp")

Type th
	Field x,y,frame
End Type

Type bh
	Field x,y
End Type

Type trees
	Field x,y
End Type

Type forest
	Field x,y
End Type

Type clouds
	Field x,y
End Type

Type aim
	Field x,y
End Type

Type dot
	Field x,y
End Type

forest.forest = New forest

trees.trees = New trees

aim.aim = New aim

dot.dot = New dot

clouds.clouds = New clouds

num = OpenFile ("screenshots/numoshot.txt")
screenhit = ReadLine(num)
CloseFile(num)

While Not KeyDown(1)
Cls

Gosub frames
Gosub movement
Gosub drawimages
Gosub attack

If KeyHit(18)
     SaveBuffer (BackBuffer(),"screenshots/hichuntscreen" + screenhit + ".jpg")
     screenhit = screenhit + 1
     num = WriteFile("screenshots/numoshot.txt")
     WriteLine(num),screenhit
EndIf

Flip
Wend

.frames

If pf = 1 Then pf = 0

Return

.movement

clouds\x = clouds\x - 1
dot\x = MouseX()
dot\y = MouseY()
aim\x = MouseX() - 15
aim\y = MouseY() - 15

Return

.attack

If MouseHit(1)
	pf = 1
	If (ImagesCollide(dotimage,dot\x,dot\y,0,treesimage,trees\x,trees\y,0))
		createhit(x,y)
	EndIf
	If (ImagesCollide(dotimage,dot\x,dot\y,0,forestimage,forest\x,forest\y,0))
		createhit2(x,y)
	EndIf
EndIf

Return

.drawimages

TileImage cloudsimage,clouds\x,clouds\y
DrawImage forestimage,0,0
updatehit2()
DrawImage treesimage,trees\x,trees\y
updatehit()
DrawImage dotimage,dot\x,dot\y
DrawImage aimimage,aim\x,aim\y
DrawImage pistol,724,468,pf

Return

Function createhit(x,y)
	treehit.th = New th
	treehit\x = MouseX() - 15
	treehit\y = MouseY() - 15
	pf = 1
End Function



Function updatehit()
     For th.th = Each th
	If th\frame < 9 Then th\frame = th\frame + 1
	DrawImage (treehitimage,th\x,th\y,th\frame)
     Next
End Function



Function createhit2(x,y)
	barkhit.bh = New bh
	barkhit\x = MouseX() - 15
	barkhit\y = MouseY() - 15
End Function



Function updatehit2()
     For bh.bh = Each bh
          DrawImage (barkhitimage,bh\x,bh\y)
     Next
End Function