Demo - Pythagorous-Studios/pythag GitHub Wiki

This is a short demonstration of the basic syntax for getting a game up and running.We'll be making an old west town to get our "cowpoke" out and about! from eng import * this imports Pythagorous's core engine

Town=game('Town')

creates an instance of game, these are used to break up the game into maps/areas;the only arg is the name of the map

Shop=place('Shop',1,1,'The finest general store in the west!')
Saloon=place('Saloon',1,2,'The Saloon,Fer all yur drinkin' needs')
SheriffsOffice=place('Sheriffs Office',1,3,'Sheriff's Office,Keepin law and order since 1834')

here we have created a few "places" for our map,a shop,saloon,and a sheriff's office The args we passed were the name of the place,its x and y coords, and a description of the place

RangerJoe=player('Ranger Joe',1,1,Town)

here we've created our fearless player "Ranger Joe" we've given him a name,x&y coords,and what map he's on So right now we've got all these fine places and players but we haven't actually added them to the map manager,"Town". Todo this we use the addplace() and addplayer() method of Town like so:

Town.addplace(Shop)
Town.addplace(Saloon)
Town.addplace(SheriffsOffice)

and to add "Ranger Joe":

Town.addplayer(RangerJoe)

Now that we've setup our boom town;your going to want to get "Ranger Joe" out and about! First lets take a look around... >>>RangerJoe.look() we'll get the description of the place our fearless cowpoke is currently in;the output of our look() command should yield 'The finest general store in the west!' To move "Ranger Joe" we'll use the goto() command like this: >>>RangerJoe.goto(1,2) Now if we want to see our new coords >>>print(str(RangerJoe.x,RangerJoe.y)) and we should get (1,2) now lets take a look around at our new position >>>RangerJoe.look() and we should get 'The Saloon,Fer all yur drinkin' needs' lets try it one more time with

>>>RangerJoe.goto(1,3)
>>>RangerJoe.look()

and we should get: 'Sheriff's Office,Keepin law and order since 1834' Congratulations Pard'ner! We got ourselves a right nice boom town to explore!