Warning: Use of undefined constant screen - assumed 'screen' (this will throw an Error in a future version of PHP) in /home/booker/public_html/wp-content/plugins/wp-codebox/wp-codebox.php on line 75

Archive for the ‘Tutorials’ Category

May

11

2011

PushButton Engine 2.0 Setup Tutorial

PushButton,Tutorials

For the past few weeks I’ve been struggling with understanding the Pushbutton engine. When I first discovered it I instantly saw all the potential, but was quite underwhelmed by the lack of documentation this complex code base had. The bad news for me (and now you) is that PushButton is in a kind of transitional state as the PBE engineers focus on what is to become PBE 2.0 and what to do with Molehill. I think it’s safe to assume the PBE guys are investigating Molehill closely and trying to figure out how best to implement it.

Well none of this helps us very much. I want to make a game now and I want to take advantage of PushButton’s integrated physics, xml based level and object generation, and component architecture. We will just have to hope that the majority of the effort we do today will carry through to the newest versions of PushButton. This tutorial only covers setting up a PBE work environment, however should any step in this process change I will try to alter the tutorial accordingly. As always use the contact link up top to let me know if you see some updates that can be done, or dead links, or bad code 🙂

Get The Latest FlashDevelop

First go get Flash Develop if you don’t already have it. One of the really awesome things about PushButton is that it doesn’t require you to own a license of flash. So us poor sauce developers can still rock out some games and make that crazy indie money. So we will be using Flash Develop to compile our swfs for us.

Get The Latest Flex

Go get the latest Flex SDK from adobe. Make sure to save the Flex SDK somewhere safe that you will remember. Now we need to link FlashDevelop to Flex. Launch FlashDevelop and select Tools->Program Settings from the File Menu. Click the “As3 Context” button to the left and navigate to the Flex SDK in the “Flex SDK Location” section.

Get The Latest PushButton

Go to get the latest PushButton build from GitHub. This tutorial is about setting up the PBE 2.0 build which is the most recent and most in flux. Its important to note that you may want to setup your own github repo pointing to this branch or at least be aware that updates occur often and might be critical. Make sure you have PBE 2.0 selected by clicking the “Switch Branches” button and selecting “PBE2”. After that click the “SOURCE” button just above the Branches button and then “Downloads” button to the right.

You Got PushButton In My FlashDevelop!

Create yourself a new “As3 Project” in FlashDevelop Project and delete the Main file FlashDevelop dumps in the src folder. Copy the src folder from the PBE branch you downloaded to your new project’s src folder. Your FlashDevelop Project should now have a com folder in it. We’re not done yet. We have to add some command line arguments to FlashDevelop or nothing using PBE will compile. Hit Project->Properties from the File Menu. Select the “Compiler Options” tab and the ellipses (…) next to the “Additional Compiler Options” field. Put this code in the resulting dialog:


–keep-as3-metadata+=TypeHint,EditorData,Embed,Inject,PostInject

Running the Examples

We’re done! (with the setup) So how about we actually do something? Copy the contents of the examples folder from the PBE branch you downloaded into your src folder. Now your src folder should have a com folder, a demos folder, and a PBEDemos.as file. Right click the PBEDemos.as file in the FlashDevelop Project Explorer and select “Always Compile” from the drop down. This will tell FlashDevelop to use this file as your Document class (it will define the swf). Hit Ctrl+Enter on your keyboard and the examples should launch for you.

In Conclusion

We have the latest build of PushButton setup in the latest build of FlashDevelop running from the latest Flex SDK. Now all you have to do is learn the API from the example files, and thats cake! Ok maybe not so much, but the examples are heavily commented. As I continue my personal studies I will continue to update with new tutorials. Although I highly suggest you follow the above processes yourself to get the latest versions of all the files and learn the process you can get a copy of my final empty FlashDevelop project below.

Empty Flash Develop Project with PushButton 2.0