Guys,
Note: I have also e-mailed each of you the images as I don't have anywhere to host as yet.
Here's the start of the Intex Systems I've been working on:
Create 'Intex-new.bb'
;Images
Global intexBackground = LoadImage("gfx\intex-background-sm.png")
Global intexFrame = LoadImage("gfx\intex-frame.png")
Global intexText = LoadAnimImage("gfx\intex-text-sm.png",8,11,0,40)
MaskImage intexText,255,0,255
;Global intexWeapon = LoadAnimImage("gfx\intex-weapons.png",320,88,0,6)
;MaskImage intexWeapon,255,0,255
Global intexChars$ = "*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:?"
Const pauseMax = 75
Const maxLines = 20
Const charWidth = 8
Const xOffset = 146
Const yOffset = 100
Type MenuSystem
Field id
Field build
Field bChar
Field bLine
Field menuText$[maxLines]
Field x[maxLines]
Field y[maxLines]
Field subMenu[maxLines]
Field highlight[maxLines]
Field total
Field pauseCounter
Field cursorRow
Field cursorX
Field cursorY
Field bCharCounter
End Type
Global intexMenu.MenuSystem
Function IntexMenu(pl.player)
Local currentMenu = 0
Local exitMenu = False
Local preBootCounter = 0
Local menuUpdateCounter
;Create a menu store
intexMenu.MenuSystem = New MenuSystem
;Get the boot text
GetMenuText(currentMenu,pl)
While Not KeyHit(1) Or exitMenu = True
;Set buffer
SetBuffer BackBuffer()
;Draw
DrawBlock intexFrame,xOffset-15,yOffset-12
DrawImage intexBackground,xOffset,yOffset
;Drawtext
ProcessMenuText()
;Individual menu functions
If intexMenu\build = False Or currentMenu = 11 Then
Select currentMenu
Case 0 ;Intex Boot
;Set menu to Main Menu
currentMenu = 1
GetMenuText(currentMenu,pl)
Case 1,2,3 ;Main Menu
DrawImage intexText,32+xOffset,intexMenu\y[intexMenu\highlight[intexMenu\cursorRow]], 0
;Menu Up/Down
If menuUpdateCounter = 0 Then
If control(pUp,pl\id) And intexMenu\cursorRow > 1 Then
intexMenu\cursorRow = intexMenu\cursorRow - 1
menuUpdateCounter = 10
ElseIf control(pDown,pl\id) And intexMenu\highlight[intexMenu\cursorRow + 1] <> 0 Then
intexMenu\cursorRow = intexMenu\cursorRow + 1
menuUpdateCounter = 10
End If
Else
;Control the speed of the menu movement
If menuUpdateCounter > 0 Then
menuUpdateCounter = menuUpdateCounter - 1
End If
End If
;Menu select
If control(pfire1,pl\id) And intexMenu\subMenu[intexMenu\highlight[intexMenu\cursorRow]] > 0 Then
currentMenu = intexMenu\subMenu[intexMenu\highlight[intexMenu\cursorRow]]
GetMenuText(currentMenu,pl)
End If
Case 7
If control(pfire1,pl\id) Then
;Return to main menu
currentMenu = 1
GetMenuText(currentMenu,pl)
End If
Case 10 ;Disconnect
exitMenu = True
End Select
End If
;Draw
Flip True
Wend
;Clear keys
FlushKeys()
;Tidyup
Delete Each menuSystem
End Function
Function GetMenuText(menu, pl.player)
Local totalLines, lines
Local lineText$, x, y, subMenu, max
Local highlight
Select menu
Case 0 ;Intex Boot
Restore menuIntexBoot
Case 1 ;Menu
Restore menuIntexMain
Case 2 ;Weapon Supplies
Restore menuIntexWeaponsSupply
Case 3 ;Tool Supplies
Restore menuIntexToolSupply
Case 7 ;Statistics
Restore menuIntexStatistics
Case 10 ;Disconnect
Restore menuIntexDisconnect
End Select
;Read the data
Read totalLines
;Clear
For lines = 1 To maxLines
intexMenu\highlight[lines] = 0
Next
;Process the lines
For lines = 1 To totalLines
Read lineText, x, y, subMenu, highlight
intexMenu\menuText$[lines] = UpdateTags(Upper(lineText), pl)
intexMenu\x[lines] = x/2 + xOffset
intexMenu\y[lines] = y/2 + yOffset
intexMenu\subMenu[lines] = subMenu
;Set line selection
If highlight <> -1 Then
intexMenu\highlight[highlight] = Lines
End If
Next
;Set remaining fields
intexMenu\build = True
intexMenu\bChar = 0
intexMenu\bLine = 1
intexMenu\id = menu
intexMenu\pauseCounter = 0
intexMenu\total = totalLines + 1
intexMenu\cursorRow = 1
intexMenu\bCharCounter = 0
End Function
Function UpdateTags$(lineText$, pl.player)
;Update tags
lineText = Replace(lineText,"%PLSCORE%",LSet(pl\score,6))
lineText = Replace(lineText,"%PLCREDITS%",LSet(pl\credits,6))
lineText = Replace(lineText,"%PLKILLS%",pl\kills)
lineText = Replace(lineText,"%PLSHOTS%",LSet(pl\shots,6))
lineText = Replace(lineText,"%PLDOORS%",LSet(pl\doors,6))
lineText = Replace(lineText,"%PLAMMO%",LSet(pl\clip,6))
lineText = Replace(lineText,"%PLENERGY%","GOOD")
lineText = Replace(lineText,"%PLCURRENTWEAPON%",Upper(pl\weapon\name)) ;Current
lineText = Replace(lineText,"%WBROADHURST%",WeaponStatus(pl\ownedWeapons[1]))
lineText = Replace(lineText,"%WDALTON%",WeaponStatus(pl\ownedWeapons[2]))
lineText = Replace(lineText,"%WROBINSON%",WeaponStatus(pl\ownedWeapons[3]))
lineText = Replace(lineText,"%WRYXX%",WeaponStatus(pl\ownedWeapons[4]))
lineText = Replace(lineText,"%WSTYRLING%",WeaponStatus(pl\ownedWeapons[5]))
lineText = Replace(lineText,"%WIMPACT%",WeaponStatus(pl\ownedWeapons[6]))
;Return
Return lineText
End Function
function WeaponStatus$(wp.weapon)
If wp<>Null Then
Return "YES"
End If
Return " NO"
End Function
Function ProcessMenuText()
Local currentChar$,x,y,maxChar,char
Local charCounter = 0
Local drawCursor = False
If intexMenu\build Then
If intexMenu\bChar > 0 Then
;Get the current char
Repeat
currentChar = Mid(intexMenu\menuText[intexMenu\bLine],intexMenu\bChar,1)
If currentChar = " " And intexMenu\bChar < Len(intexMenu\menuText[intexMenu\bLine]) - 1 Then
;Skip over any spaces
intexMenu\bCharCounter = intexMenu\bCharCounter + 1
intexMenu\bChar = intexMenu\bChar + 1
ElseIf currentChar = "+" Then
;We need to pause
intexMenu\pauseCounter = (intexMenu\pauseCounter +1) Mod pauseMax
Exit
Else
;Exit out
Exit
End If
Forever
End If
;Continue to process text
If intexMenu\pauseCounter = 0 Then
;Increment number of shown characters
intexMenu\bCharCounter = intexMenu\bCharCounter + 1
;Increment char
intexMenu\bChar = (intexMenu\bChar + 1) Mod Len(intexMenu\menuText[intexMenu\bLine])
If intexMenu\bChar = 0 Then
;Increment line
intexMenu\bLine = (intexMenu\bLine + 1) Mod intexMenu\total
If intexMenu\bLine = 0 Then
;Set each item to it's max
intexMenu\bLine = intexMenu\total - 1
intexMenu\bChar = Len(intexMenu\menuText[intexMenu\bLine])
;Finish
intexMenu\build = False
FlushKeys()
End If
End If
End If
End If
;Draw text
For drawLine = 1 To intexMenu\bLine
;Set co-ords for current line
x = intexMenu\x[drawLine]
y = intexMenu\y[drawLine]
;Draw current line
For drawChar = 1 To Len(intexMenu\menuText[drawLine])
;Increment letter count
charCounter = charCounter + 1
;Get current char
char = Instr(intexChars, Mid(intexMenu\menuText[drawLine],drawChar,1)) - 1
If char > -1 Then
DrawImage intexText,x,y,char
End If
;Building the menu, if so pause on last char and display cursor
If intexMenu\build Then
;Slight pause when first displaying character?
If (charCounter = intexMenu\bCharCounter) Then
Delay 15
intexMenu\cursorX = x
intexMenu\cursory = y
drawCursor = True
Exit
End If
End If
x = x + charWidth
Next
If drawCursor Then
DrawImage intexText,intexMenu\cursorX,intexMenu\cursorY,0
Exit
End If
Next
End Function
;Data Structure
;No of lines
;Text$,X,Y,SubMenu
.menuIntexBoot
Data 10
Data "INTEX NETWORK CONNECT: CODE ABF01DCC60 ",8,96,-1,-1
Data "CONNECTING..................... ",8,120,-1,-1
Data "INTEX NETWORK SYSTEM V10.0 ",8,168,-1,-1
Data "2G RAM: OK ",8,192,-1,-1
Data "EXTERNAL DEVICE: OK ",8,216,-1,-1
Data "SYSTEM V1.10 CS: OK ",8,240,-1,-1
Data "VIDEODISPLAY: DAMAGED+ ",8,264,-1,-1
Data "EXECUTING DOS 5.0 ",8,312,-1,-1
Data "SYSTEM DOWNLOADING NETWORKDATA..... OK ",8,336,-1,-1
Data "INTEX EXECUTED!+ ",8,360,-1,-1
.menuIntexMain
Data 8
Data "INTEX MAIN MENU ",192,64,-1,-1
Data "INTEX WEAPON SUPPLIES ",144,136,-1,1
Data "INTEX TOOL SUPPLIES ",160,160,3,2
Data "INTEX RADAR SERVICE ",160,184,-1,3
Data "LEVEL INFORMATION UPDATE ",128,208,-1,4
Data "INTEX ENTERTAINMENT ",160,232,-1,5
Data "STATISTICS ",240,256,7,6
Data "EXIT INTEX NETWORK ",176,280,10,7
.menuIntexWeaponsSupply
Data 2
Data "INTEX WEAPON SUPPLIES ",144,48,-1,-1
Data "WEAPON SUPPLIES REQUEST: ",48,96,-1,-1
.menuIntexToolSupply
Data 8
Data "INTEX TOOL SUPPLIES ",160,72,-1,-1
Data "ELECTRONIC HAND MAP 500 CR ",64,144,-1,1
Data "AMMO NYBBLE 1000 CR ",64,192,-1,2
Data "FIRST AID KIT 2000 CR ",64,240,-1,3
Data "6 KEYS 4000 CR ",64,288,-1,4
Data "EXTRA LIFE 10000 CR ",64,336,-1,5
Data "EXIT ",288,384,1,6
Data "YOUR CREDIT LIMIT IS: %PLCREDITS% CR ",80,432,-1,-1
.menuIntexStatistics
Data 16
Data "INTEX STATISTICS ",176,32,-1,-1
Data "PLAYER SCORES: %PLSCORE% PTS ",80,80,-1,-1
Data "ALIENS KILLED: %PLKILLS% ",80,104,-1,-1
Data "SHOTS FIRED: %PLSHOTS% BULLETS ",112,128,-1,-1
Data "CREDITS OWNED: %PLCREDITS% CR ",80,152,-1,-1
Data "DOORS OPENED: %PLDOORS% ",96,176,-1,-1
Data "AMMO OWNED: %PLAMMO% CLIP",128,200,-1,-1
Data "ENERGY STATE: %PLENERGY% ",96,224,-1,-1
Data "CURRENT WEAPON: %PLCURRENTWEAPON%",64,248,-1,-1
Data "WEAPONS AVAILABLE: ",16,272,-1,-1
Data weaponBroadhurst + "... %WBROADHURST% ",48,320,-1,-1 ;112
Data weaponDalton + "... %WDALTON% ",48,344,-1,-1
Data weaponRobinson + "... %WROBINSON% ",48,368,-1,-1
Data weaponRyxx + "... %WRYXX% ",48,392,-1,-1
Data weaponStyrling + "... %WSTYRLING% ",48,416,-1,-1
Data weaponImpact + "... %WIMPACT% ",48,440,-1,-1
.menuIntexDisconnect
Data 1
Data "DISCONNECTING..............+ ",32,128,-1,-1
Other Changes:
;Player.bb ----------------------------------------------------------------------------------
type player
Field score, kills, shots, doors
End Type
;Function Player_updateall
; weapons (player specific)
If control(p_weapon1,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponBroadhurst))
If control(p_weapon2,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponDalton))
If control(p_weapon3,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponRobinson))
If control(p_weapon4,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponRyxx))
If control(p_weapon5,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponStyrling))
If control(p_weapon6,pl\id) Then EquipWeapon(pl\id,getWeaponFromName(weaponImpact))
;Engine.bb -----------------------------------------------------------------------------------
createWeapon(1,weaponBroadhurst, 1.5, 5, 25, 100, 3.0, 2, 21, "sfx\mgun.mp3", "", "sfx\pistolreload1.mp3")
createWeapon(2,weaponDalton, 10.0, 1, 25, 500, 6.3, 1, 22, "", "", "")
createWeapon(3,weaponRobinson, 8.0, 5, 25, 300, 2.6, 0, 23, "", "", "")
createWeapon(4,weaponRyxx, 0.4, 5, 25, 100, 3.0, -1, 24, "", "", "")
createWeapon(5,weaponStyrling, 1.5, 5, 25, 100, 3.0, 3, 25, "", "", "")
createWeapon(6,weaponImpact, 1.5, 5, 25, 100, 3.0, 3, 26, "", "", "")
;Script.bb ------------------------------------------------------------------------------------
;Function RunScript
Case "pickupweapon"
Select Int(si\param)
Case 1:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponBroadhurst))
Case 2:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponDalton))
Case 3:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponRobinson))
Case 4:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponRyxx))
Case 5:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponStyrling))
Case 6:giveWeaponToPlayer(pl.player,getWeaponFromName(weaponImpact))
End Select
Case "opendoor"
opendoor(Floor(x/32),Floor(y/32))
;Update counter for player status
pl\doors = pl\doors + 1
;Weapons.bb ---------------------------------------------------------------------------------
Const weaponBroadhurst$ = "Broadhurst DJ Twinfire 3LG"
Const weaponDalton$ = "Dalton Arc Flame"
Const weaponRobinson$ = "Robinson Plasma Gun"
Const weaponRyxx$ = "Ryxx Firebolt MK22"
Const weaponStyrling$ = "Styrling Multimatic"
Const weaponImpact$ = "High Impact Astro Laser"
;Function Shoot
;Update counter for player status
p\shots = p\shots + 1
; create muzzle flash
p\weapon\fireSoundChannel=PlaySound(p\weapon\fireSound)
;Function HandleBullets
For al.alien = Each alien
If ImagesCollide(bulletgfx,b\x,b\y,1, al\image,al\x-al\offset,al\y-al\offset,al\dir)
;circlesoverlap(al\x,al\y,al\radius,bx+16,by+16,3)
; knock alien back
If Rand(1,10)=1
al\x = al\x + (Sin((al\dir*45)+180))*3
al\y = al\y - (Cos((al\dir*45)+180))*3
EndIf
killed = alien_hit(al,b\damage)
If killed = True Then
;Update counter for player status
b\owner\kills = b\owner\ammo + 1
End If
ok=False ;bullet hit alien
EndIf
Next
;Aliens.bb ------------------------------------------------------------------------------------------
Function alien_hit(al.alien,damage#=1.0)
al\health = al\health - damage
al\mode="underattack"
If Rand(0,2)=0 Then playoneshot(snd_alienhit(Rand(0,3)),al\x,al\y)
;random alien blood splats
d=Rand(0,359)
f=Rand(0,3)
createparticle(al\x,al\y,Sin(d)*2,Cos(d)*2,Rand(10,100),f,f,particles,16)
If al\health<=0 Then
alien_die(al)
;Return true so we know the alien died
Return True
End If
Return False
End Function
Also add this stuff into engine.bb
Include "inc\intex-new.bb"
If KeyHit(23) Then IntexMenu(player(1)):time=MilliSecs()-period ;Need to determine player activates
Hopefully that's everything - if not, get it in there and I will check to see if anything is missing.