Kalinium
764 posts
|
Topic: Game Programming /
Resetting Variables?? in AS3
Originally posted by Senekis93:About the random thing, int(Math.random()*11)+2 will give you a random between 2 and 12, which covers any possible combination of two six-sided dices.
Rolling two 6-sided dice is not the same as rolling one 12-sided dice.
Originally posted by Senekis93:
Yes, the more the Math.random calls, the less random the result will be. I’m unsure about the inner workings of the method itself, but as a rule, if you want the closest to a random number, just call it once.
An example of what Aesica means:
100,000 tests…
Result: 2 3 4 5 6 7 8 9 10 11 12
2x6: 2759 5438 8304 11306 13949 16300 14000 11102 8546 5544 2752
1x12: 9093 9261 8882 9148 9259 9003 9024 9113 8988 9137 9092
I don’t think you understand the reason for this at all. It has nothing to do with how the random function works.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Saving as a bitmap from a swf
With AS2 you’re back to what Moonkey first posted.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
AS2, Beginner, struggling for Terms
You’ll find more help from the inbuilt help (F1) than you will from google if you already have coding experience.
|
|
|
Kalinium
764 posts
|
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Paving a path
Contain all the movieclips you want to outline as a group in a single movieclip and apply a glow filter to that.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Registration Point Problem?
I remember having this problem before, I just can’t remember how I fixed it. I’m pretty sure it was because I was applying some scaling to a movieclip, though.
|
|
|
Kalinium
764 posts
|
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Registration Point Problem?
Is the ship contained in another movieclip? Did the quick *2 fix I suggested before work?
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
wierd object removal problem
I’d edit your first post and put the code in pre tags.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
wierd object removal problem
I don’t use AS3 so I can’t check your specific code, but you could try placing these into a container movieclip and then removing the container movieclip.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
wierd object removal problem
Your URL got cut up and you should use pre tags to post code, but as a wild guess: You can’t remove objects that were placed on the stage in the editor (at least, not just with removeMovieClip()).
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Registration Point Problem?
If you move the mouse further/closer to the origin, you’ll notice that the ship isn’t a fixed number of pixels from the mouse. Closer to the origin, closer to them mouse.
Now if you move the mouse as far from the origin as possible, bottom right, you’ll notice that the ship has gone to the middle of the screen. This means the ship is moving half as far as it should be in order to keep up with the mouse. So we can take a guess at what’s happening: at any point, the ship is half way between the mouse and the origin.
Try it out, and it looks like that’s the case. If you’re after a cheap fix, try multiplying mouseX/Y by 2 and seeing if that fixes your problem. I wouldn’t advise that as a permanent fix, though. First guess makes it seem like somewhere in your code is some sort coefficient of the coordinates isn’t what it should be.
Your only code that effects the ship’s coordinates (aside from constructor) is a relative movement (ie, x -= not x =), x -= distx / 10. This doesn’t look like it’ll be causing the problem. If this is your only AS relating to the problem, then we should try looking at something other than the AS. Perhaps the ship is contained in a parent MC that has a scalefactor applied?
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Movement and collisions?
Of course, you could just realise it doesn’t make any difference either way.
Use what you like best.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Playing sounds from classes
While you set up your variable footstep and make it a Sound, you never actually make it into a Sound properly, it’s just an undefined Sound:
footstep = new Sound();
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Boolien [AS2]
He’s not asking to change their avatar, he’s asking how he gets the specific avatar for the player.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Kongregate Flash 6K Competition.
If someone’s put the effort in to make the game, don’t fault them on a technicality.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Kongregate Flash 6K Competition.
With 6,144,000 bytes, you shouldn’t have to worry about 2-3 bytes.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Kongregate Flash 6K Competition.
Originally posted by UnknownGuardian:
Originally posted by truefire:
explain please? a few bytes is a lot when all you have to wokr with is 6kb. and sorry to sound like a noob, but what do you mean by “method”?, i dont know most of the lingo, except what i learn from the docs.
Edit: whoops, misread “a few bytes” as “a few kb” lol =P
Like function whatever . If that works, you could save bytes by trimming variable names too.
These things sound like such completely pointless methods of optimization. My game fits into the 6k limit, yet I barely had to worry about it.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Kongregate Flash 6K Competition.
Using fonts takes up a large amount of space (a single font might even take up all 6kb). Some fonts use less space than others.
Using the size reports is very helpful for finding out where you’re wasting kbs.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Question about variable assignment in classes.
Drop traces in all over the place. Keep tracing the variable whenever it’s changed/moved anywhere. Look at all the outputs and find the one where it breaks down, and it’ll probably become clear what’s wrong.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
[AS2] Line code.
Detecting a collision between a line and a MC can be very complex, depending on the precision you want and the shape of the MC.
To remove the line, I would remove the container MC that you drew it in. However, you create what is probably a container MC but don’t actually use it: You shouldn’t have _root.lineStyle…, simply lineStyle… (ditto for the other lines in that with() { } block.).
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Best Programmer on Kong
Skeptical about those commas, brian.
Also skeptical about the supposed list of best coders on Kongregate.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
Best Programmer on Kong
bumped from a whole 2/3 days ago.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
baking an animation? [AS2]
I don’t see why you couldn’t do this. A ragdoll is a little different – presumably you want the ragdoll to respond in a new way each time – but for the flame, which is probably very similar every time, you could create a series of bitmaps the first time the flame is used, then simply cycle through those instead of the actionscript until the settings are changed for the flame. As for turning the actionscript animation into a permanent bitmap animation before the final .swf is run, it’s probably harder than it’s worth.
|
|
|
Kalinium
764 posts
|
Topic: Game Programming /
My 'many questions to success' thread ;P
If he really means he’s using MX and not MX 2004, he will need to be using AS1.
|