Advertisement
beefviper

XMLGameEngine - Pong.xml

Sep 17th, 2020
939
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.43 KB | None | 0 0
  1. <game>
  2.     <head>
  3.         <title>Pong</title>
  4.         <screen width="1280" height="720" background="color.black" fullscreen="false" />
  5.     </head>
  6.     <body>
  7.         <variables>
  8.             <variable name="margin" value="30" />
  9.             <variable name="radius" value="20" />
  10.             <variable name="width" value="30" />
  11.             <variable name="height" value="150" />
  12.         </variables>
  13.         <objects>
  14.             <object name="logo">
  15.                 <sprite src="shape.circle(radius)" />
  16.                 <position x="screen.width.center" y="screen.height.center" />
  17.                 <velocity x="0" y="0" />
  18.                 <actions>
  19.                     <action start="state.playing" />
  20.                 </actions>
  21.             </object>
  22.             <object name="ball">
  23.                 <sprite src="shape.circle(radius)" />
  24.                 <position x="screen.width.center - radius" y="screen.height.center - radius" />
  25.                 <velocity x="random.range(-10,10)" y="random.range(-5,5)" />           
  26.             </object>
  27.             <object name="paddle1">
  28.                 <sprite src="shape.rectangle(width,height)" />
  29.                 <position x="screen.left + margin" y="screen.height.center - height / 2" />
  30.                 <velocity x="0" y="0" />
  31.                 <collision enabled="true" />
  32.                 <actions>
  33.                     <action name="up" value="move.up(2)" />
  34.                     <action name="down" value="move.down(2)" />
  35.                 </actions>             
  36.             </object>
  37.             <object name="paddle2">
  38.                 <sprite src="shape.rectangle(width,height)" />
  39.                 <position x="screen.right - margin - width" y="screen.height.center - height / 2" />
  40.                 <velocity x="0" y="0" />
  41.                 <collision enabled="true" />
  42.                 <actions>
  43.                     <action name="up" value="move.up(2)" />
  44.                     <action name="down" value="move.down(2)" />
  45.                 </actions>             
  46.             </object>
  47.         </objects> 
  48.         <states>
  49.             <state name="mainmenu">
  50.                 <show object="logo" />
  51.                 <inputs>
  52.                     <input action="logo.action.start" button="enter" />
  53.                 </inputs>
  54.             </state>
  55.             <state name="settings">
  56.                 <show object="logo" />
  57.                 <inputs>
  58.                     <input action="game.unpause" button="escape" />
  59.                 </inputs>
  60.             </state>
  61.             <state name="playing">
  62.                 <show object="ball" />
  63.                 <show object="paddle1" />
  64.                 <show object="paddle2" />
  65.                 <inputs>
  66.                     <input action="paddle1.action.up" button="q" />
  67.                     <input action="paddle1.action.down" button="z" />
  68.                     <input action="paddle2.action.up" button="up" />
  69.                     <input action="paddle2.action.down" button="down" />
  70.                 </inputs>
  71.             </state>
  72.             <state name="paused">
  73.                 <show object="logo" />
  74.                 <inputs>
  75.                     <input action="game.start" button="spacebar" />
  76.                 </inputs>
  77.             </state>
  78.         </states>
  79.     </body>
  80. </game>
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement