NineFiveThree
1370 posts
|
Topic: Game Programming /
Open Source Isometric Game
as3isolib is open source, why start from the ground up?
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Logical OR help
With an additional or operator…
condition && true || false
condition ? true : false
|
|
|
NineFiveThree
1370 posts
|
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Classes and keyboard
Originally posted by Ace_Blue:
Shouldn’t Maingame return :void too?
No. While :void is a valid return type a constructor can have, it’s usually omitted.
The method “keyPress” however should have that return type.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Classes and keyboard
Originally posted by AlexanderC4:
i’m in flash pro cs6 and i clicked Ctrl-shift-enter to go into debug mode
Post your entire code, not just some lines.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
[AS3] TextField deformation [Solved!]
Originally posted by Ace_Blue:
I would much prefer a method that preserves the integrity of the TextField.
Prefer or need? Why?
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
how to make heart containers like zelda [SOLVED]
First of all, this code is hard to maintain and not very flexible. (imagine a 5th state)
Place the movieclips into an array, if the amount of points changes, you simply play the (i-1)th element.
You for loop does not work, for several reasons:
1) you cannot place variables into names and expect flash to replace them by the value:
watermelon1_i is just that, i is not replaced
to solve that, use the array as mentioned above.
2) a for loop is run as quick as possible
your loop would play the mcs simultaneously
instead, use a debugger (like the demonsterdebugger) which allows you to call functions and see what happens.
the function you want to call is the one that increases the watermelonpoints variable.
A set function and Events can really help glue things together nicely
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Help with saving a class to a SharedObject
Your problem is the Singleton, it’s a) not well written and b) used in the wrong way.
It looks like you just copy&pasted the singleton code partly without knowing what it does or why you would want to use it.
The point of a singleton is to guarantee that only one instance of a class can be generated.
Instead of creating the class with the new operator, your use the static method getInstance()
You should create a variable referencing the object as you do with any other class.
And that’s it. The idea is not to make all members of that class static. (as you do with test)
The way you throw the error doesn’t make much sense. It’s fine to query the class for the single instance multiple times – that’s actually how you guarantee that instance to be one and the same even when called multiple times.
Don’t force patterns.
Create the class you want to hold the data as a regular one, if necessary, turn it into a singleton later.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
how to make heart containers like zelda [SOLVED]
What animation you play depends on how many pieces have been collected.
Please post your code.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Leap Motion
Originally posted by jonathanasdf:
Originally posted by NineFiveThree:
Except that this kind of control is actually quite tiring.
more tiring than this?
http://www.youtube.com/watch?feature=player_embedded&v=qpHWJMytx5I
probably not, but still quite tiring.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Leap Motion
Except that this kind of control is actually quite tiring.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
AS3 tutorials
Originally posted by feartehstickman:
This website has some step-by-step tutorials.
private var _root:MovieClip;
//...
_root = MovieClip(root);
step by step in the wrong direction
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
How would you do this
iterate over the array,
sum the elements up,
if the sum is bigger than the random Number, pick the current element.
Yes, normalizing to make the sum 1 is a good idea, because that’s what probabilities are like.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
[AS3] OOP Question
Originally posted by Jephz:
I was hoping that I could have the item parameter to substitute for whatever class I decide to plug in later. Apparently, its not that simple.
It is that simple and Bob gave you the code.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
FlashDevelop Embed Loop
Originally posted by Feffers:
@ninefivethree
To be honest, I’m not quite sure what you mean by that. I was simply asking whether I could use FlashDevelop’s embed differently to break down the workload.
Let the computer do the work and read the file from a directory (or multiple) and create the code for you.
|
|
|
NineFiveThree
1370 posts
|
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
FlashDevelop Embed Loop
You’re a programmer and you ask how to simplify a tedious task.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
What is wrong with this AS3 code?
Originally posted by UnknownGuardian:
Since it was a correct guess, I believe the reason behind that logic is that classes default to internal and thus aren’t available outside the package.
yes.
@gamebuilder:
rule of thumb: if it has a “stageRef” in DisplayObjects that you want to display, the tutorial is rubbish.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Display Method for FlashDevelop That's Not Blitting?
Originally posted by TheBeocro:
Hey everyone. I have a question. Is there an easier method to display external images on the stage without blitting in FlashDevelop? It’s because for the small game I made, blitting seems a bit overkill in terms of saving performance. I’d appreciate any feedback. :)
You already do that, because you have to addChild() at least one Bitmap to the display list in order to display it, even if you do blitting.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Questions about classes
Originally posted by austin_farmer90:
Hey, everybody, I just had a couple of questions about classes that I was wondering if I could get some help with.
First off I have an object in my scene, that has a class with some script in it. Its just your basic movement script. It doesn’t have any errors or warnings when its compiled, but for some reason nothings working when I play it just sits there. So, my question is do I need to call the script in the timeline some way, or tell it to activate?
That obviously depends on the script that you are using.
Originally posted by austin_farmer90:
variables public, even if they dont get accessed why not leave the door open just in case?
Leaving the door open is not a good idea.
You should consider everything that you do not control to be the worst that could possibly happen.
Make things as private as you can.
To provide access, use a getter and setter method.
Even if you practically expose your private variable as a public one by using getters and setters, you are still in charge to check the given inputs to be plausible.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
AS3 Quick Question About Parameters
Originally posted by GameBuilder15:
Another question I had: Why is the :void required?
In general, you should specify a type, if you can.
Knowing the type instead of figuring it out is one way to make programs execute faster.
You also gain type safety when compiling, which makes finding mistakes easier.
Originally posted by GameBuilder15:
Is it because the parameters aren’t empty?
The return type has nothing to do with the parameters.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
AS3 Quick Question About Parameters
It’s the same top level class that GameBuilder referred to.
Originally posted by RTL_Shadow:
For example, I believe you can’t open a URL without having a MouseEvent or KeyboardEvent.
no.
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
AS3 Quick Question About Parameters
Around since FP 6:
Key.addListener(this);
function onKeyDown():Void
{
trace("pressed key: " + Key.getCode());
}
|
|
|
NineFiveThree
1370 posts
|
|
|
|
NineFiveThree
1370 posts
|
Topic: Game Programming /
Cant use arguments in my function ?
Do not extend Stage, use Sprite instead.
|