Play the games, create the levels

Topic, Sharing AS3 Classes

Checkout our iPhone & iPad games!

You must register or log in to post a message.

manufan 4 years ago
  Bumping just to say I'm making a Mouse-Gesture recognition library which could be of use. Depends on how far I get with the project as to whether or not I post here, and ofc whether people would be happy and willing to receive it.
SimonM 5 years ago
  Or you can use tweener classes.
geckojsc 5 years ago
  I see you already figured out a solution, but the way most tween libraries work is by using a timer variable (lets call it 't'). Every frame, measure the amount of time that has passed since the last frame (or add a constant value like 1/30, for 30fps).

Now you can get a ratio of progress for the timer: using t/duration will give you a decimal value between 0 and 1, where 0 means the timer has just begun, and 1 means the timer has finished.

Now, you must use an interpolation function to mix between the start value and end value. For example:


So, say you want to move the player from x=100 to x=200 over a period of 2 seconds, you can do something like this:

manufan 5 years ago
  I'm bumping this topic in search of a solution to a problem I have involving Maths.

Basically, I want to create a function a bit like the Scratch function:

glide from [ start ] to [ finish ] in [ time ]

I set up a class and calculated distances x & y between the start and finish points. However, I need some sort of formula to work out the length of the average line (an angle bisector of 90 degrees) based on my distance x and y.

Thanks! :)


[EDIT] Never mind, figured out a way simpler solution.
SimonM 6 years ago
  Come to chat. Average is very simple. Nobody uses the most of the others.
manufan 6 years ago
  MathUtils contains:

MathUtils() [Throws an Error]

average(a:Array) [Returns the average of the numbers in an array]

formatAsCurrency(c:String, n:Number, english:Boolean, decimal:Boolean) [See FlxU.formatMoney() - c = the symbol]

formatAsDate(d:Date) [Returns a String along the lines of "Monday 3rd September 2012"]

formatAsTime(d:Date, seconds:Boolean, showGMT:Boolean) [Returns a string along the lines of "14:31:00 (GMT +1)"]

roundToNearest(n:Number, r:Number) [Returns an integer.]

Other functions MathUtils has are used by other functions, such as formatAsDate() uses getWeekday().
SimonM 6 years ago
  MathUtils, what kind of math functions will it contain?
manufan 6 years ago
  At the moment, there is a MathUtils class. It uses some of the old BL MathUtils and some new ones to do with dates - and even uses one function from Flixel. All functions in that class are public static also.

If you want to work on it with me, I'll create a shared folder for it on DropBox.
SimonM 6 years ago
  What kind of utilities? Maybe I could help you with it.
manufan 6 years ago
  Simon, I wasn't actually making a library just for the data. XD

I was making a library to help with games as a whole - utilities that could take forever to script in a game - especially when you want to keep the file size down.

For Beginners: Object Oriented Programming in AS3
SimonM 6 years ago
  I hope, you know understand why making a library for this is not very useful, because it can be done in a few lines.
manufan 6 years ago
  Very Good Simon - nice & detailed, (of course I know it), gives users a very good 'grip' on what they are learning. Your comments were very clear also.
SimonM 6 years ago
  Made a small very compact explanation of level data things in BL with AS3: level data
SimonM 6 years ago
  A library for that is not really needed, because it's just a few lines of code in AS3.
manufan 6 years ago
  I'm making an ActionScript 3.0 Library, but I'm not sure what to call it. The name will be the prefix of all the classes, a bit like Flixel - FlxG, FlxText, etc.

At the moment, I'm sticking with Game as the prefix. The idea of the library is to help with making Games that involve level data serialization (e.g. BL Games).
manufan 6 years ago

I'm not sure whether it's very good, I'd just like feedback infact, but I decided to code an Animation Engine in AS3. It's not that user friendly, but I just want to know:

a) Whether my code is right.
b) Is it actually useful.

It was targeted at the FlashDevelop Community, even though this was made in Flash CS6, due to the fact that everything has to be coded, and so there's no drawing MovieClips or IK.

Parameters & Functions

PRIVATE: MOVIE_LIST (An Array storing all MovieClips)
PRIVATE: TOTAL_FRAMES (Total Frames of the MovieClip)

CONSTRUCTOR: Animation(empty_object:MovieClip, movie_list:Array, total_frames:int)

The class also includes 7 other functions (one private, containing a 'for' loop) and the others for timeline control, such as gotoAndStop();


Next Updates
- No need to supply an Empty MovieClip
- More Suggestions Welcome
Hexicube 7 years ago
  "@Birjo: No, but it is Great as a remote E-mail if your Internet Access is down..."
if your internet is down it wont work...
manufan 7 years ago
  Bump! Just finished a "Mouse" class in AS3 which does what Gecko's "Keys" class does but with the Mouse. However, I need to rename it because there is already a Mouse class with the root flash.ui.Mouse (thanks to allyally for pointing it out). Any ideas?

It's a static class, so goofy names won't work. :S

@Gecko: Also, you said throwing exceptions was good practice. How come you didn't throw an exception for your constructor function in your "Keys" class?
SimonM 7 years ago
  Manufan, you can use Array.sortOn(Array.DESCENDING | Array.NUMERIC) and Array.sortOn(Array.NUMERIC) for ascending numbers in AS3.
manufan 7 years ago
  Not really a class, just a discovery, but I figured out that not only does Array.sort(); sort Strings alphabetically, but also sorts Numbers Numerically, and possibly (not tried it out yet) sorts Dates chronologically!

Edit: You'll need Array.reverse(); if you want to sort them Chronologically, it does it backwards!
manufan 7 years ago
  I've ran out of ideas for my editor class! Can anyone help?
manufan 7 years ago
  Jasper, this is not an AS3 thread, it is about producing classes for AS3 or AS2 (Gecko doesn't mind exceptions).
jasperpostema 7 years ago
  Why using sites or books when you have reallife persons :P
BTW I love making games.
manufan 7 years ago

I'm thinking about making a very useful class, a basic editor class that I will use, that extends from MyEditorManager. You can enhance the code in any way you like, to your specifications, and before you aks "WHERE DA F*** IS THE LINK?" there isn't one, becuase it hasn't been made yet. :)
manufan 7 years ago
  @Birjo: No, but it is Great as a remote E-mail if your Internet Access is down...

I used the mail function in PHP, that's how it actually e-mails people.
birjolaxew 7 years ago
  "That many people will find useful" Wait a minute... How is it useful? Seriously...

It's no good adding it to a website. Both HTML, PHP and Javascript have easy e-mail functions available.
There's no reason to add it to a standalone .swf because... Well, why would you?
manufan 7 years ago
  Here we are, my Email class file. For the PHP File, please PM me.

Email [V.0.1] AS3 by Manufan.
manufan 7 years ago
  I'm not teaching anyone GIS, just asking whether they want this Class.

@Birjo: Epic! I will post my code soon
birjolaxew 7 years ago
  Just dropping this off here. Decided to code a bloom filter.

And some example code. For an actual example of it in action, see this.
gameinsky 7 years ago
  Manufan, if you are so eager on "teaching" us, why not make your own topic...

[1] [2] [3]

Flash game development

First post of the topic

geckojsc 8 years ago
  Here's a topic for developers to find, create and share AS3 classes/libraries.
If you are still using AS2, I highly recommend downloading the free Flex SDK and FlashDevelop tools. There's a great tutorial on the FlashPunk site.

AS3 SFXR is great tool for making video game sound effects. Use the interface to perfect your noise, then use the free SfxrSynth class to generate and play your sounds on the fly without importing any .wav files! Magic.

Flixel and FlashPunk (thanks to JP for pointing them out) are both libraries which allow you to make sprite-based games easily by extending the base classes.

Calista is a collection of cryptography classes. You will need a SVN client to download it though, or you could use the source browser to copy the files individually.

Tweener will help you to move things around the stage smoothly using only code. Great when you're using Flex.
Our free flash games   Games for your site   Games for your iPhone   Contact   Twitter @jpsarda & @bonuslevelorg