skyboy
5922 posts
|
Topic: Game Programming /
external non-SWF library, how to create? Or should I?
Base64 encode the PNGs then use a Base64 decoder to generate a ByteArray you pass to a Loader to get an image in the onComplete handler; or use vector stroke/fill/etc instructions of your own design. i suggest create a GraphicsPath that you can then pass to Graphics::drawGraphicsData
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Odd issue with two identical, simultaneously attached, objects
Originally posted by Solanix: so you’re telling me that 8, 9 and 10 are not above 5?
they’re in a different order of magnitude. if you change it to 4 (possibly), you’ll get 5/6/7 in the same loop. the hashing function returns substantially different values for 8+ due to its design.
have fun working out the exact details of Dictionary here: http://hg.mozilla.org/tamarin-redux/file
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Odd issue with two identical, simultaneously attached, objects
Originally posted by Solanix: Could you please explain this to me then?: var d:Dictionary = new Dictionary();
d[5] = true;
for (var o:Object in d) {
trace(o + " is being updated."); if (o == 5) {
var temp:int;
do {
temp = Math.random() * 10 + 1;
} while (temp == 5);
d[temp] = true;
trace(temp + "has been added.");
do {
temp = Math.random() * 10 + 1;
} while (temp == 5);
d[temp] = true;
trace(temp + "has been added.");
}
}
If I roll a 6 and/or a 7 with the above, those values get ‘updated’ within the same frame they were created. Any other values rolled are only updated next frame.
because the values are sorted. in AS3, the returned values are always sorted; whereas in AS2 they were iterated in the order they were created.
you start at 5, any value that your method adds that is above 5 will be in the next pass of the loop. the next value is retrieved at the end of the loop, not all at once at the beginning.
that’s trivial, what draco is experiencing isn’t possible if the code he’s posted is all that affects it. that’s why i suggested he find out what’s calling the function and how with the stack trace Error can give you. i’ve recently used that very method to track down a bug i didn’t think actually occurred.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Odd issue with two identical, simultaneously attached, objects
Originally posted by Solanix: There’s no index to screw up in a dictionary. The issue is that any of the two added bullets could be added to a key that as already been (or would have been) updated/passed depending on when Ship is updated within the dictionary.
flash is not threaded. it’s physically impossible to have code do this in flash.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
I'm A Rookie C++ Programmer
sarainia, it’s very difficult to read your posts (i can barely read the first post before glazing over) when there is no punctuation and paragraphs aren’t separated. please correct your grammar.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
[Solved] Timer not firing as it is supposed to
RTFM
You can create Timer objects to run once or repeat at specified intervals to execute code on a schedule. Depending on the SWF file’s framerate or the runtime environment (available memory and other factors), the runtime may dispatch events at slightly offset intervals. For example, if a SWF file is set to play at 10 frames per second (fps), which is 100 millisecond intervals, but your timer is set to fire an event at 80 milliseconds, the event will be dispatched close to the 100 millisecond interval. Memory-intensive scripts may also offset the events.
Parameters
delay:Number — The delay between timer events, in milliseconds. A delay lower than 20 milliseconds is not recommended. Timer frequency is limited to 60 frames per second, meaning a delay lower than 16.6 milliseconds causes runtime problems.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Odd issue with two identical, simultaneously attached, objects
var b:Bullet = new Bullet(x + 50, y + 6);
trace("Adding bullet", b.id); // id should be an instance variable set from an incrementing static variable; of type uint
Game.main.spriteClip.addChild(b);
b = new Bullet(x + 50, y - 6);
trace("Adding bullet", b.id);
Game.main.spriteClip.addChild(b);
public function Bullet::enterFrame(e:Event):void {
trace("enterFrame for bullet", this.id);
trace(new Error().getStackTrace());
}
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Which is better? To load from XML or JSON?
JSON is faster to parse and access the properties of at runtime
|
|
|
skyboy
5922 posts
|
Topic: Kongregate /
Not running an Ad-blocker.
Originally posted by rawismojo: We’re working on figuring out what the OP is running into (not having an adblocker and seeing those ads) but K+ users definitely shouldn’t be seeing them and we figured out what happened and we’re gonna fix it.
i’m having the same issue, actually. the on_adblock_detected_handler is null, and when the script is run to replace the ads with that image, googletag services are pending. shortly after, they are no longer pending; however. so that check seems stupid (and definitely not what it should be used for)
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Software Architecture question for a Collectible Card Game
if the new abilities can’t be described with existing effects in the game, then the most viable alternative to recompiling and redistributing the updated client (which shouldn’t be that hard in the first place) is to make a pseudo language that you can parse and execute at runtime.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Hurro, it's me again.
Originally posted by vesperbot: those pixels you speak of seem to be “non-white but pretty white” aka something like 0xf0f0f0, which are not counted as strictly white and therefore their alpha is not zeroed. I suggest use an external PNG editor to draw the required bitmaps first, then import them as Bitmap classes, and use normal “new ThePNG()” to instantaneously create a transparent Bitmap class instance with your picture.
0xFEFEFE
also, i suggest the threshold method.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
problem with boolean and if statements [solved]
Originally posted by Draco18s: Somehow I was causing a pass-by-reference when flash uses pass-by-value for basic data types.
that can happen if you don’t declare the type. it will get coerced to an Object (but remain an int) and have its memory address passed around (the different name caused MXMLC to generate the bytecode differently; likely correctly function-scoping the original while the latter was class-scoped due to timeline code). it’s why strict typing and lack of timeline code are important.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Proper way to do collision detection
Originally posted by Senekis93: They’re just rectangles; check position+speed+size vs neighbouring tiles.
to elaborate:
every object is a rectangle. you have to store the rectangle for the objects, and information about the objects somewhere. this gives you everything you need to move the player well, and handle obstacles well. however, since you probably didn’t design for it, you will likely need to implement a broad-phase collision detection system; something like a quad tree should work well for your needs
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Links wont work
Originally posted by mont266lbb: @draco I learnt how to make flash games in AS2.. I am not sure how different AS3 is to it but there is never a good source of information on how to learn it.
there are over a thousand tutorials for learning AS3, and over a thousand for switching from AS2 to AS3. just became you suck at looking things up doesn’t mean they don’t exist; go hit google. (or better yet, read the making games thread)
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
[Flash] Single line that takes over 60 seconds to execute
Originally posted by jonathanasdf: I don’t understand why you need to need to take just the odd elements :\
actually, i’m setting every element to either a 1 or a 0. i could use my own counter, but one is handily given to me as the second parameter; first param is the element, undefined in this case; third is the array itself, though it’s useless with this
you were thinking of the filter method
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
[Flash] Single line that takes over 60 seconds to execute
Array(1000000).map(function(...b){return b[1]&1}).sort(16);
https://twitter.com/#!/skyboy026/status/165724349423300608
Meanwhile, my fastSort function manages it in under 6 seconds in the debug player. I use quickSort, Adobe uses quickSort.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
concat(null)
Originally posted by qwerberberber: YaomingBitchPleaseFace.png Concatenates the elements specified in the parameters with the elements in the Vector and creates a new Vector. If the parameters specify a Vector, the elements of that Vector are concatenated. If you don’t pass any parameters, the new Vector is a duplicate (shallow clone) of the original Vector.
I’m thinking that concat(a,b) will work
RTFC
private function _concat(items:Array) {
var v = newThisType();
v.private::_spliceHelper(0, length, 0, this, 0);
const bug504525:Boolean = bugzilla(504525);
for ( var j:uint=0, limit=items.length ; j < limit ; j++ ) {
var item = castToThisType(items[j]);
const insertPoint:uint = bug504525 ? v.length : length;
v.private::_spliceHelper(insertPoint, item.length, 0, item, 0);
}
return v;
}
on the bright side, we now know why the bugzilla function exists and returns a value.
on the down side, constants aren’t. (setting a constant in a loop!? it’s not even scoped there! AS3 doesn’t have block-scoped variables!)
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
concat(null)
Originally posted by qwerberberber: hrrm, if a vector can contain nulls why can’t I concat them? adobe logic.
because you concat vectors, not nulls. use push if you want to add a null to the end.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
concat(null)
Originally posted by BigJM: You can pass nothing to concat if you want to concat nothing.
slice is better suited for that. and it’s stupid that they try to access properties of null yet treat undefined as though it’s normal. they do the same thing in sort and sortOn.
i reported it as a bug, but i got some idiot who didn’t speak english well, he closed the ticket saying i was wrong or something to that effect. i don’t think he even works for Adobe.
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Pro and cons of Starling
Originally posted by Attila0413: I’ve seen that deploying for AIR gives access to additional features. Does it also give a notable performance boost to the game?
not without an unreasonable work load. (hint: it’s equivalent to programming the game in C++ for each platform)
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Pro and cons of Starling
pros:
fast execution when the user has hardware acceleration for Stage3D
cons:
slow execution, perhaps unplayable, when the user does not have hardware aceleration
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Can someone please explain something?
also, this is fully valid syntax:
if (abc) {
breakable: {
if (!bcd) break breakable;
trace("Hello");
}
{
doSomething(), doSomethingElse();
doThat() || doThis();
super.canDo() && do();
}
breakme: while (true) {
i = j + w;
innerbreak: while (i--) {
if (arr[i] == findme) break breakme;
switch (arr[i].$var) {
case that:
j += that._var;
break;
case murder: break innerbreak;
default:
}
}
j -= width;
}
}
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Left 4k dead
Originally posted by UnknownGuardian: If someone bumps a thread like this from a bajillion years ago, just flag the post (and don’t post yourself). I can delete the post that bumped and the thread will go back to where it came from.
active sorting. i like that in a forum.
|
|
|
skyboy
5922 posts
|
|
|
|
skyboy
5922 posts
|
Topic: Game Programming /
Yet another is this legal thread
Originally posted by Draco18s: (Inferno sound effects really are just animal roars slowed waaaaay down)
because the actual sound of fire/explosions aren’t as exhilarating as that; just as how real silencers don’t actually silence anything (a few db; rarely below 100), yet in the movies it sounds like an arrow went by
|