TGC Codebase Backup



text based rpg cobland by iron_man

20th Dec 2006 17:32
Summary

non completed text based rpg



Description

i have never designed a game or anything. i read a little tutorial, and this is what i got. i dont know whats wrong with it, but it slows my pc down. if you can, solve the problem and send it back to me plz. it sais something about the button function but nothing else.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Do
if Button(275,205,"New Game")=1 then Goto New_Game
if Button(275,235,"Load Game")=1 then goto load_game
if button(300,265,"exit")=1 then end
loop


New_Game:
cls
Text 240,220,"..........loading................";
wait 2000
cls
print "NPC:Hello and welcome to cobland."
wait key
cls
do
if button(275,235,"go to town")=1 then goto go_to_town
if button(275,265,"quit game")=1 then end
loop
wait key

function Button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(0,0,255),0 else ink rgb(255,0,0),0
if pressed=1
Pressed=Mouseclick()
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed

load_game:
cls
text 240,220,"................loading.............."
wait 3000

go_to_town:
cls
text 275,195,"NPC:Welcome to the town of cobland."
wait 5000
cls
do
if button(275,205,"head to shop")=1 then goto Shop
if button(275,235,"inn")=1 then goto Inn
if button(275,265,"quit game")=1 then end
loop
cls
wait key

Shop:
cls
Print "NPC: welcome to the shop"
wait key

Inn:
cls
print "NPC:welcome to the inn."
wait key