Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - hansbe

Pages: 1 2 3 ... 18
Ask a Question / Re: How to make collectibles stay collected?
« on: September 05, 2012, 03:38:09 pm »
If you search in the forge for 'collectible' i think you should find my example. Please say if it doesn't work!

Ask a Question / Re: Some questions about sound/audio in Stencyl...
« on: August 19, 2012, 05:07:30 am »
sound.filters = [ new FlangeFilter (int = 17600, Number = 880,  Number = 0.7) ];
Causes all sorts of mayhem:
Implicit coercion of a value of type int to an unrelated type Class.
Illegal assignment to class int.
Implicit coercion of a value of type Class to an unrelated type
Implicit coercion of a value of type int to an unrelated type Class.
Illegal assignment to class Number.
Implicit coercion of a value of type Class to an unrelated type stencyl.api.engine:GameState.
Incorrect number of arguments.  Expected no more than 2.
Illegal assignment to class Number.

Hansbe, any more tips you can share?

Try this line in stead:
sound.filters = new FlangeFilter(17600, 880,  0.7);

Also, when you add code it should go inside a class and a function/method?

That's why you run the test multiple times.

Sorry, I ran the loops lots of times, but the time each loop runs for (the number of iterations) can cause a difference, as the CPU might break off and do other tasks before continuing.

According to [ ], the local attribute is faster, but it is the calls to propertyChanged() and setGameAttribute() that take up time in the tests. I know I had 11 local variables and only 3 game attributes, so that might cause the difference.

Like Kajiti said, most of the time these differences don't have a lot to say. Basic game loops can do with a few hundred operations, but if you are running some code that requires a loop to run through thousands of times, it may be of importance. An easy optimization in many cases would be to grab the relevant code that stencyl generates, put it in a code block, and put propertyChanged() outside the loop (or delete it if it isnt relevant). (If you are handling game attributes, then store them in a local variable until you are ready to update.)

Ask a Question / Re: Some questions about sound/audio in Stencyl...
« on: June 26, 2012, 03:11:50 pm »
I put the com directory in the preview folder. (The com directory is inside the src folder)

(Mind that everything under the com directory also appears there as it should. Copy and paste from the windows explorer zip tool only got the com directory, not the contents. )

Then in a game I add into a new script
Code: [Select]

and test the game, and tada it compiles !

(Actually first it didn't, since the com directory was empty. Then there was no error message, but the game failed to show up. Some error messages only appear in the log, so particularily if you work with freeform mode, you could keep this open with your favorite notepad reader, or if you started stencyl from the console you may see some message there.)

Anyhow this doesn't do anything yet. But that's up to you to figure out ;)

You can use the import statements almost whenever in AS3, so you can put them in a code block wherever and start coding, or you can use freeform mode and make some scripts.

There's definetely a calculation error 9718/100 is closer to 97 not 9.7 but ill look at it later.
My test results might be off a bit since it took so long background tasks might affect the result as well. But I have at least learned that AS3 is horribly slow when compared to properly compiled c++ code.

Ask a Question / Re: Some questions about sound/audio in Stencyl...
« on: June 25, 2012, 02:25:38 pm »
Like I said, (very cryptically), I think you can unzip the and copy what's in the src directory into the preview folder. Then you can do import com.anttikupla.*; from stencyl code/blocks, and start using the package. However the preview directory is kind of unstable so i don't know if this is the best way. Perhaps making the com directory read-only could be useful. Anyway this technique appeared to work for publishing, but its not transferable (i.e. you cant upload a game where this is done). And I don't know if there's any better way of doing it.

Ask a Question / Re: Question about lists within lists and saving
« on: June 25, 2012, 09:58:23 am »
Saving and loading lists of lists works for me ..

But I don't think you can save just anything, so it might be a good idea to stick to numbers, texts and lists.

Ask a Question / Re: Music Programm
« on: June 21, 2012, 05:09:02 pm »
Hmmm ... is PXTone great ?

I wouldn't know because I haven't used it (downloaded and had a look around only)

I spent a lot of time with trackers from 1993-2001'ish. ProTracker, FastTracker, ScreamTracker, ImpulseTracker, and then I had a school course using Cubase but never quite liked it. Trackers have a different interface than the musician oriented programs. E.g. you won't get a piano roll, or a score sheet, rather you'll get the notes as characters and a number for the octave.

Anyway. Here's my suggestion:
One of the coolest things I thought came out was Jeskola Buzz. I never ended up making much music with it because it was simply too fun to play with. The author lost the source code in a HD crash, so it stopped development for about 8 years, but now it seems to be alive and kicking again.

I don't know what's IT on the tracker front anymore, I just know I'm very surprised if it's PXTone, although I can see how the interface can have an appeal ... And it's probably quite cute, even powerful when you master it ... I just thought IT would be more.

The difficulty is much better now. Really gorgeous art! :)

Resolved Questions / Re: Newbie question about grid (x/y) positioning
« on: June 21, 2012, 12:00:16 am »
Sorry, I ended up not answering your question. You can turn off 'movement'. Just check the different actor settings tabs, there are many options.

Resolved Questions / Re: Newbie question about grid (x/y) positioning
« on: June 20, 2012, 10:33:10 pm »
Can I tweak the game so a collision does NOT move the player unit in any way?

You can set the collision shape to be a sensor. Or you can remove the collision shape. Or you can disable physics alltogether.

Ask a Question / Re: Why is this "Mute Button" Code not working?
« on: June 20, 2012, 11:25:29 am »
I dont see anything wrong with it. If you do a "load game" or change muted somewhere else, muted could reset. What exactly seems to be the issue?
I might add I would add a 'stop all sounds' / 'play "music"' when i mute/unmute, (in the belief that the music and sounds would still be using resources playing at 0% volume, they probably wont but you never know).
Edit: Actually I see it's possible to pause and resume sounds, which seems even more appropriate for a mute button.

I think if you investigate the preview folder after a test, you see what gets included.
Doesn't seem to be quite the case.
Anyway, behaviors won't affect the final result much. Images and music more so.

Thanks Mr. Knight.

You could be right about event listeners.
I tested a few with this code.
Code: [Select]
var foo:Number =0;
var foo2:Number =0;
This timed to about 174 ms, so with 100k iterations at 2.26 GHz each iteration is (0.174/0.1M)*2260M ~= 3932 cycles.

It will however be neccessary to call isKeyDown about 250 times on a 1 GHz computer to create '1 ms of lag'. So it's not likely to be a common suspect.

Testing getMouseX() in the same loop as above executes at about 35 ms, so this is faster. (~ 791 cycles)
Then actor.isMouseReleased() uses 81-114 ms (~ 1830 to 2574 cycles) depending on where the mouse is positioned (which means it must be testing the bounding box before it checks the released condition).

By the way, I noticed that the empty procedure call I had above actually executes slower, so I think i had a mistake for that one. (I've corrected it now.) However the empty procedure call is > 600 cycles, so it can help to do things locally.

I found this:
It has a lot of good AS3 tips.

Pages: 1 2 3 ... 18