Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- Working on an idea I had to describe a game in a format that could be parsed and rendered
- by a game engine/framework. I played with a few syntaxes and found an HTML/XML style looked good.
- It's still missing parts, like a way to describe the rules of the game.
- It's not consistent. Still not sure how to handle elements with multiple parameters.
- But I like the overall look and feel so far.
- If you have any ideas or suggestions, let me know.
- - beefviper
- -->
- <game>
- <head>
- <title>Pong</title>
- <screen width="1280" height="720" fullscreen="true" />
- </head>
- <body>
- <objects>
- <object name="logo">
- <sprite src="images/title.png" />
- <position x="screen.width.center" y="screen.height.center" />
- <velocity x=rand(10) y=rand(10) />
- <actions>
- <action start="state.playing" />
- </actions>
- </object>
- <object name="ball" />
- <sprite src="shape.circle(radius)" />
- <position x="screen.width.center" y="screen.height.center" />
- <velocity x=rand(10) y=rand(10) />
- </object>
- <object name="paddle1">
- <sprite src="shape.rectangle(width,height)" />
- <position x="screen.left + margin" y="screen.height.middle" />
- <velocity x="0" y="0" />
- <collision enabled="true" />
- <movement horizontal="false" vertical="true" />
- </object>
- <object name="paddle2">
- <sprite src="shape.rectangle(width,height)" />
- <position x="screen.right - margin" y="screen.height.middle" />
- <collision enabled=true />
- <velocity x="0" y="0" />
- <movement up="true" down="true" left="false" right="false" />
- <actions>
- <action up="movement.up" />
- <action down="movement.down" />
- </actions>
- </object>
- </objects>
- <states>
- <state name="mainmenu">
- <show object="logo" />
- <inputs>
- <input logo.action.start="enter" />
- </inputs>
- </state>
- <state name="settings">
- </state>
- <state name="playing">
- <show object="ball" />
- <show object="paddle1" />
- <show object="paddle2" />
- <inputs>
- <input paddle1.action.up="q" />
- <input paddle1.action.down="z" />
- <input paddle2.action.up="up" />
- <input paddle2.action.down="down" />
- </inputs>
- </state>
- <state name="paused">
- </state>
- </states>
- </body>
- </game>
Add Comment
Please, Sign In to add comment