Installing FlashPunk


(Jacob Albano) #1

FlashPunk is an ActionScript 3 library, meaning it is not a piece of software or single program, but rather a huge collection of ActionScript 3 (.as) files that contain helpful code for setting up your games, rendering different types of graphics, resolving in-game collisions between objects, and much, much more. In order to use it, you’re doing to have to download the library and import it into your projects.

There are two ways to get FlashPunk into your project. First, head over to the download page.

Using the source folder

This is the method you’ll want to use if you have any intentions of hacking the code yourself. Click the button that says “Source code (zip”) and download the archive.

If you’ve followed the Setting up FlashDevelop tutorial, you know how to start a new basic AS3 Project and compile it. To add FlashPunk into your current project, first extract the archive you downloaded. Contained should be a folder called net; everything within that folder is FlashPunk. Copy that whole net folder into your project next to your Main.as class. Once you’ve done that, your project directory (relative to Main.as) should look like this:

net/
	flashpunk/
		debug/
		graphics/
		masks/
		tweens/
		utils/
		Engine.as
		Entity.as
		FP.as
		...etc.
Main.as

Using the Adobe class library

Thanks to @Ultima2876 for contributing these steps!

Click the button that says “flashpunk-1.x.x.swc” and download the file.

Copy the downloaded SWC file into your project folder (you can create a ‘lib’ folder if you like, or just put it in the root directory - no need to extract the swc file itself as this is its own self-contained library package!)

From within FlashDevelop’s project explorer, right click the swc file and choose ‘add to library’.

Once you’ve got that all set up, you’re ready to proceed to FlashPunk Basics!


(Nibiki) #2

Heya! Trying to follow the tutorial, the directions say to extract the archive you downloaded, but it’s a .swc file. Opening it in winrar, I don’t see any /net/ folder, just some xml and swf documents. What am I missing? Is the download link for FlashPunk pointing to the wrong thing?

(I found a copy of the /net/ folder in the source at the github link.)


(Zachary Lewis) #3

This video shows you how to use an .swc file.


(Nibiki) #4

It’s almost been a year, but thank you Zach! Friggen great job on this video! : D


(Ryan Campbell) #5

I have a problem. I’ve extracted the necessary files to be installed, but there’s no ‘lib’ folder to place the folder into. All I see is a ‘src’ and ‘bin’ folder and a file that says ‘References’. Did I do something wrong? I know that I’m using the right kind of project (AS3). Can anyone help me?

BTW I’m using FlashDevelop 4.5.2


(christopf) #6

I think you need to put the .net folder into the src folder.


(Jacob Albano) #7

Are you using the SWC release, or the source folder?


(Ryan Campbell) #8

I downloaded flashpunk from the link on the website’s front page. The file contains these three things when It first opens up in 7zip:

docs
catalog
library

According to the tutorial, there should be a folder called .net that goes straight into the ‘lib’ folder (which I have still not found yet), but the only .net files are in the ‘docs’ folder, and they are all separate from each other. I tried putting the docs folder into both the src and bin folders, but that didn’t do anything.

I’m using the SWC release.


(Ultima2876) #9

The installation tutorial should be updated really as it’s still pertaining to the pre-SWC days. If you’re using the SWC release there won’t be a net folder (that folder contains the FlashPunk source and is only applicable if you have downloaded the source code to use directly in your project). You have two options:

  1. Download the ‘source’ release and follow along with the tutorial that way; https://github.com/Draknek/FlashPunk/archive/v1.7.2.zip (available from the ‘Get FlashPunk 1.7.2’ page from the button marked “Source Code (zip)”

  2. Stick with the SWC and do the following instead of the ‘net’ folder stuff:

  3. Create a new FlashDevelop project

  4. Copy the downloaded ‘flashpunk-1.7.2.swc’ file into your project folder (you can create a ‘lib’ folder if you like, or just put it in the root directory - no need to extract the swc file itself as this is its own self-contained library package!)

  5. From within FlashDevelop’s project explorer, right click the swc file and choose ‘add to library’.

From there, you can follow the tutorials as normal as FlashPunk will be included in your project :slight_smile:


(Jacob Albano) #10

I was under the impression that we had decided to make the source folder the default download option. We talked about it here: Download link for FlashPunk

But now the SWC is apparently the more obvious choice. :confused:

I’ll update the tutorial with your instructions to make it easier in the future.


(Ultima2876) #11

I agree that the source download should be the ‘default’ method. That said, the SWC does have the advantage that it makes upgrading easier for newer users (dissuades ‘hacking’ the FlashPunk source).


(Ryan Campbell) #12

Thank you! Flashpunk is working now! I really appreciate your help.


(Zachary Lewis) #13

I just pointed the download link to the latest release on GitHub, so the user can choose what to download.