I am starting a Christmas game (so I don't run out of time like I did last year), and I spent the last few hours doing this:
http://www.newgrounds.com/dump/item/1e7f 75de20d43cafdbc094ec6f6ccad4
At 11/7/10 08:22 AM, Archawn wrote: http://www.newgrounds.com/dump/item/1e7f 75de20d43cafdbc094ec6f6ccad4
Link fail; how did that happen?
At 11/7/10 08:23 AM, Archawn wrote: Cumulative Snow
Can you show the source for the fps counter? I've never understood how to make them.
Also, to keep fps down are you caching as bitmap?
At 11/7/10 08:39 AM, Chickumbleh wrote:At 11/7/10 08:23 AM, Archawn wrote: Cumulative SnowCan you show the source for the fps counter? I've never understood how to make them.
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.getTimer;
public class FPSCounter extends Sprite{
private var last:uint = getTimer();
private var ticks:uint = 0;
private var tf:TextField;
public function FPSCounter(xPos:int=0, yPos:int=0, color:uint=0xffffff, fillBackground:Boolean=false, backgroundColor:uint=0x000000) {
x = xPos;
y = yPos;
tf = new TextField();
tf.textColor = color;
tf.text = "----- fps";
tf.selectable = false;
tf.background = fillBackground;
tf.backgroundColor = backgroundColor;
tf.autoSize = TextFieldAutoSize.LEFT;
addChild(tf);
width = tf.textWidth;
height = tf.textHeight;
addEventListener(Event.ENTER_FRAME, tick);
}
public function tick(evt:Event):void {
ticks++;
var now:uint = getTimer();
var delta:uint = now - last;
if (delta >= 1000) {
var fps:Number = ticks / delta * 1000;
tf.text = fps.toFixed(1) + " fps";
ticks = 0;
last = now;
}
}
}
}
To add one:
addChild(new FPSCounter());
Also, to keep fps down are you caching as bitmap?
Each flake is a sprite, and as they hit the pile of snow or the bottom of the screen, they are added to a BitmapData instance and deleted.
Currently they are not cached as bitmaps, as I did not encounter any lag. If it starts to lag, I'll do that--I just don't want to sacrifice CPU usage for a few hundredths of FPS optimization.
At 11/7/10 08:23 AM, Archawn wrote:At 11/7/10 08:22 AM, Archawn wrote: http://www.newgrounds.com/dump/item/1e7f 75de20d43cafdbc094ec6f6ccad4Link fail; how did that happen?
Cumulative Snow
It's amazing what you can do with a little ingenuity. I mean, if I was making snow, I would have just made it fall down the stage and get removed, but for it to pile up like that, I can really see it adding to the game's atmosphere. Good luck with that game!
At 11/5/10 08:25 PM, Luis wrote: Ummm if anyone is in dublin next week you should come and hang out!
I have to remind myself that essentially the meets really started here in this forum/thread. And my heart and liver is still here.
wow since when do you have your face instead if the level icon ?
looks cool..
At 11/7/10 10:17 AM, Archawn wrote: Code
Thanks, the code works excellently.
And about Luis' icon, he got employed and there was an art contest.
At 11/7/10 10:17 AM, Archawn wrote: Currently they are not cached as bitmaps, as I did not encounter any lag. If it starts to lag, I'll do that--I just don't want to sacrifice CPU usage for a few hundredths of FPS optimization.
Awesome engine.
Perhaps I'm completely wrong, but if it does start to lag, perhaps blitting would be useful? Speed of cacheAsBitmap with a significantly decreased memory usage!
Snow
Are you doing the "settling" by spreading it out to the sides if there isn't already snow there or is it more than that?
1) Ridiculous CPU usage. Iterating over each pixel in the bitmap? You can represent the snow height with a 1d array.
2) FPS counter is coupled to the textbox. The code that does math should be in a separate unit (class) from Flash garbage.
3) Mike: He'll always have 2d arrays over you? Lol.
At 11/7/10 05:08 PM, GustTheASGuy wrote: 1) Ridiculous CPU usage. [...]
You don't come around to spread sunshine and joy nearly enough these days
At 11/7/10 05:00 PM, HDXmike wrote: What does everyone else here spend their spare money on?
Food, or when I get enough I buy an instrument that I can't play...
At 11/7/10 02:41 PM, patu1 wrote:At 11/5/10 08:25 PM, Luis wrote: Ummm if anyone is in dublin next week you should come and hang....wow since when do you have your face instead if the level icon? looks cool..
At 11/7/10 05:00 PM, HDXmike wrote:
What does everyone else here spend their spare money on?
rent and food and internet
At 11/7/10 02:52 PM, HDXmike wrote: Making the snow pile up was easy but then I saw how it settled, I think using bitmap data is the one thing you'll definitely always have over me.
At 11/7/10 05:08 PM, GustTheASGuy wrote: 3) Mike: He'll always have 2d arrays over you? Lol.
And you know, being a better programmer, better looking, better accent, nicer person, etc etc.
At 11/8/10 03:17 PM, BoMToons wrote: How dare you start a new page!
Your momma starts a new page.
In my pants.
What is the best way to draw a sine curve in flash using only code? I don't think my current method will run well on slower computers.
At 11/8/10 06:43 PM, Chickumbleh wrote: What is the best way to draw a sine curve in flash using only code? I don't think my current method will run well on slower computers.
Any reason you can't do this?
var resolution:Number = (2 * Math.PI) / 360;
var m:Sprite = new Sprite();
addChild(m);
m.graphics.lineStyle(1, 0xFF0000, 1);
m.graphics.moveTo(0, 0);
for(var i:int = 0; i < (2 * Math.PI) / resolution; i++){
m.graphics.lineTo(i, Math.sin(i)*10);
}
I just multiplied everything by 10 so the wave can be seen.
At 11/8/10 07:04 PM, Archawn wrote:At 11/8/10 06:43 PM, Chickumbleh wrote: What is the best way to draw a sine curve in flash using only code? I don't think my current method will run well on slower computers.Any reason you can't do this?
var resolution:Number = (2 * Math.PI) / 360;
var m:Sprite = new Sprite();
addChild(m);
m.graphics.lineStyle(1, 0xFF0000, 1);
m.graphics.moveTo(0, 0);
for(var i:int = 0; i < (2 * Math.PI) / resolution; i++){
m.graphics.lineTo(i, Math.sin(i)*10);
}
I just multiplied everything by 10 so the wave can be seen.
Wow thanks, I had my waves made of hundreds of circle with radii of 1 px, your method makes much more sense. Thanks again.
Also, is the 10KB game challenge still open?
At 11/8/10 07:18 PM, Chickumbleh wrote: Also, is the 10KB game challenge still open?
Nah, it ended a while ago and only three of the ten users that joined sent me their source code for the approval process and compilation.
It's a shame. Hopefully if I start something similar in the future, more people will cooperate.
tada. Archawn's thing looked funny because it was using degree's in the sin function!
sinCurve(100, 5, 4);
public function sinCurve(amplitude:Number, frequency:Number, cycles:Number):void
{
var curve:Sprite = new Sprite();
addChild(curve);
curve.graphics.lineStyle(1, 0xFF0000, 1);
curve.graphics.moveTo(0, 200);
for(var i:int = 0; i < 360*cycles; i++)
{
curve.graphics.lineTo(i/frequency, 200 + Math.sin(i*2*Math.PI/360)*amplitude);
}
}
Anyway... I've got a game near complete bar the sounds and I'm having a hard time tweaking the difficulty, flow of the game etc ( Either get overwhelmed to quickly or not enough enemies and its to easy). Wondering if anyone would be interested in taking it out for a test drive!I'll send the link for it on the test grounds. It's an 'into' screen shooter kinda like space harrier.
There's a neat picture in me profile.
Cheers!
At 11/8/10 07:51 PM, SantoNinoDeCebu wrote: tada. Archawn's thing looked funny because it was using degree's in the sin function!
Yeah, I'm so used to thinking in degrees. Also I'm lazy.
At 11/8/10 10:20 PM, Glaiel-Gamer wrote: poop
Your Mum has poop.
In a cup.
At 11/9/10 03:04 AM, Deadclever23 wrote:At 11/8/10 10:20 PM, Glaiel-Gamer wrote: poopYour Mum has poop.
In a cup.
two glaiels one cup
At 11/7/10 01:58 PM, funkycaveman wrote: I win?
winner of the OCD contest