My Project

Blitz3D Forums/Blitz3D Beginners Area/My Project

Zach3D(Posted 2005) [#1]
What do you think of this so far, and where do u think i should go from here.This is going to be a game like runescape
(runescape.com)


{code}
;==============
;Ore Properties
;==============
Type Ore
Field Hits
Field Exppoints
Field Charges
Field Cool
End Type

Tin.ore = New ore
Copper.ore = New ore
Iron.ore = New ore
Silver.ore = New ore
Black.ore = New ore
Coal.ore = New ore
Adamant.ore = New ore
Mithril.ore = New ore
gold.ore = New ore
Magic.ore = New ore
;=================
;Setup Ore
;=================
Tin\hits = 5
Tin\exppoints = 10
Tin\Cool = 5
Tin\charges = 2
Copper\hits = 5
Copper\exppoints = 10
Copper\Cool = 5
Copper\charges = 2
Iron\hits = 10
iron\exppoints = 18
Iron\cool = 8
Iron\charges = 2
Silver\hits = 13
silver\exppoints = 22
Silver\cool = 14
silver\charges = 2
Black\hits = 18
black\exppoints = 25
black\cool = 17
black\charges = 3
coal\hits = 21
coal\exppoints = 40
coal\cool = 22
coal\charges = 4
Adamant\hits = 25
adamant\exppoints = 50
Adamant\cool = 26
adamant\charges = 4
Mithril\hits = 30
mithril\exppoints = 60
Mithril\cool = 30
mithril\charges = 4
gold\hits = 32
gold\exppoints = 75
gold\cool = 32
gold\charges = 4
magic\hits = 35
magic\exppoints = 95
magic\cool = 40
magic\charges = 1
;================
;Rock Properties
;================
Type Rock
Field Position[3]
Field Rotation[3]
Field Tint[4]
Field Model
Field OreType$
End Type
;===================
;CreateRock Function
;===================
Function CreateRock.rock(x,y,z,ore$)
NewRock.rock = New rock
NewRock\model = CreateCone()
PositionEntity NewRock\model,x,y,z
NewRock\Position[1] = EntityX(NewRock\model)
NewRock\Position[2] = EntityY(NewRock\model)
NewRock\Position[3] = EntityZ(NewRock\model)
NewRock\Rotation[1] = 0
NewRock\Rotation[2] = 0
NewRock\Rotation[3] = 0
PositionEntity NewRock\model,x,y,z
newrock\tint[4] = 1

Select Lower$(ore$)
Case "tin"
NewRock\tint[1] = 125
NewRock\tint[2] = 125
newrock\tint[3] = 125
EntityColor NewRock\model,125,125,125
Case "copper"
NewRock\tint[1] = 255
newrock\tint[2] = 105
newrock\tint[3] = 0
EntityColor NewRock\model,255,105,0
Case "iron"
Newrock\tint[1] = 196
newrock\tint[2] = 89
newrock\tint[3] = 10
EntityColor Newrock\model,196,89,10
Case "silver"
Newrock\tint[1] = 192
newrock\tint[2] = 192
newrock\tint[3] = 192
EntityColor Newrock\model,192,192,192
Case "black"
Newrock\tint[1] = 0
newrock\tint[2] = 0
newrock\tint[3] = 0
EntityColor Newrock\model,0,0,10
Case "coal"
Newrock\tint[1] = 55
newrock\tint[2] = 55
newrock\tint[3] = 55
EntityColor Newrock\model,55,55,55
Case "adamant"
Newrock\tint[1] = 25
newrock\tint[2] = 123
newrock\tint[3] = 9
EntityColor Newrock\model,25,123,9
Case "mithril"
Newrock\tint[1] = 5
newrock\tint[2] = 167
newrock\tint[3] = 62
EntityColor Newrock\model,5,167,62
Case "gold"
Newrock\tint[1] = 144
newrock\tint[2] = 149
newrock\tint[3] = 7
EntityColor Newrock\model,144,149,7
Case "magic"
Newrock\tint[1] = 114
newrock\tint[2] = 10
newrock\tint[3] = 108
EntityColor Newrock\model,114,10,108

End Select
Return NewRock
End Function
;================
;Program Sequence
;================
Graphics3D 900,700,32,2

Cam = CreateCamera()
CameraViewport Cam,0,0,900,700

Light = CreateLight()
RotateEntity Light,0,90,0
Global printer$ = " "
X.rock = CreateRock(25,0,25,"iron")
Y.rock = CreateRock(50,0,0,"magic")
Z.rock = CreateRock(-25,0,-5,"gold")
MoveEntity X\model,0,-5,0
MoveEntity Y\model,0,-5,0
MoveEntity Z\model,0,-5,0
Global TIMER# = 0
Global IRONAM = 0
Global GOLDNAM = 0
Global MAGICNAM = 0
Global PLAYERGOLD = 0
Global BOX = CreateCube()
EntityColor Box,255,0,0
ScaleEntity Box,5,0.1,5
MoveEntity Box,0,-5,5
Main_loop = True
While Not KeyHit(1) And Main_loop
TIMER# = TIMER# + 0.00000001
If TIMER# >= 60000000000000
Cls
TIMER# = 0
EndIf
If KeyDown(200)
MoveEntity Cam,0,0,1
EndIf
If KeyDown(203)
MoveEntity Cam,-1,0,0
EndIf
If KeyDown(208)
MoveEntity Cam,0,0,-1
EndIf
If KeyDown(205)
MoveEntity Cam,1,0,0
EndIf

UpdateWorld
RenderWorld
Text 25,50,"You have " + IRONAM + " iron."
Text 25,60,"You have " + GOLDNAM + " gold."
Text 25,70,"You have " + MAGICNAM + " magic ore."
Text 500,5,"Go next to an ore and press A to mine it."
Text 500,25,"Step on the square and press L to sell ores."
Text 500,45,"Gold Coins: " + PLAYERGOLD
If KeyHit(38) And EntityDistance(Cam,BOX) < 10
InventorySpace = InventorySpace - (IRONAM + GOLDNAM + MAGICNAM)
PLAYERGOLD = PLAYERGOLD + (IRONAM * 15) + (GOLDNAM * 35) + (MAGICNAM * 40)
IRONAM = 0
GOLDNAM = 0
MAGICNAM = 0

EndIf
If KeyHit(30)
If EntityDistance(Cam,X\model) < 10
If InventorySpace < 28
Text 25,25,"You mine iron."
IRONAM = IRONAM + 1
InventorySpace = InventorySpace + 1
Else
Text 25,25,"Your inventory is full."
EndIf
EndIf
If EntityDistance(Cam,Y\model) < 10
If InventorySpace < 28
Text 25,25,"You mine magic."
MAGICNAM = MAGICNAM + 1
InventorySpace = InventorySpace + 1
Else
Text 25,25,"Your inventory is full."
EndIf
EndIf
If EntityDistance(Cam,Z\model) < 10
If InventorySpace < 28
Text 25,25,"You mine gold."
GOLDNAM = GOLDNAM + 1
InventorySpace = InventorySpace + 1
Else
Text 25,25,"Your inventory is full."
EndIf
EndIf
EndIf
Flip
Wend


Rubiks14(Posted 2005) [#2]
one thing that your could do is to make a class inside your ore type just to free up some space. like this

Type Ore
Type Class
Field Hits
Field Exppoints
Field Charges
Field Cool
End Type

like i said that would free up some space and make your code a little more managable but since you already have it set up like that then i wouldn't go threw the time to change it. but anyway it looks good so far, and if it ends up being anything like runescape when it's done then i'll sure play it because for some reason i am addicted to that game