Recent posts by Argl on Kongregate

Flag Post

Topic: Game Programming / Troubles with Array lenght!

Thanks for the detailed info. I think I’ll go with the Vector on this case, it will be stricter as you said. Regarding enums, I need to learn more about it. I just copied your code to try it on a bigger project.

I remember your bullet hell, it was cool :)

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

Each time I step into this forum, I realize my lack of general programming knowledge. Looking into that ;)

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

Thanks Draco18s.

Giving the amount of equipment piece I have (10-30 for each type = around 100 pieces) your way wouldn’t be very handy to manage and to sort all that equipment. Especially because the order of each piece is not definitive and will be subject to change/balance.

EDIT (counter edit :p) : the reason I use label is because it’s way more clear to manage. Having 30 frames of equipment all stacked together is really crappy to handle, especially when you wanna change the order. Using label in simple arrays, allows me to very easily switch equipment positions without getting involved with the movie clip itself.
NB : I should have mention that the ‘armor’ upgrade affects, by himself, 4 other different clips (body, foot, handL, handR, etc.). So I need to be able to change all those at once.

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

“Do not use the Array class to create associative arrays” => that’s what I meant I didn’t know, and that’s what surprised me. I know that associative arrays are not bad in themselves ^^

Well really it’s nothing fancy. I just have a few pieces of equipment (armor, ranged weapon, shield, weapon). Each can be upgraded multiple time. The equipment art changes with each upgrade. So, each 4 types of equipment has it own clip which contains all different upgrade under different labels. (‘leather’, ‘rusty’, etc.)

So in the code I showed you, I’ve defined all those labels into arrays. Then I retrieve the correct label using the upgrade level as an index. For example: if my armor is upgraded to level 2. I command to the armor clip :


gotoAndStop(LISTS[‘armo’][armorUpgradeLevel])

Even if I’m pretty much done with that game, I would be happy to learn a new proper way to achieve that kind of thing.

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

… Damn it. So ridiculous. I don’t understand why the compiler didn’t warn me about that during exportation. It usually tells me when a property doesn’t exist. I already use FlashDevelop and I enjoy auto completion, but as you can see there is no auto completion for LISTS[‘weap’] because the type is not known by the IDE. Thanks guys anyway!

@NineFiveThree : interesting, I didn’t know associative arrays were deprecated by Adobe. May I ask you how you would write this kind of structures using Object? Would it be something like that :


var armor:Object = {
item1:String = ‘leather’
item2:String = leatherHard’
}

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

Originally posted by vesperbot:

Neither, this is only the case with “Array”, as there is an “Array function” that makes an array out of its parameters. var a=Array(1,2,3,4,5) will make a new Array into a variable “a” that’ll contain “[1,2,3,4,5]”. All other function only try doing a typecast, returning a “null” if the supplied object is not of the desired type. So, after you call that typecast, you can do if (myClip!=null) myClip.gotoAndStop(1); for example.

Thanks for your explanation, makes more sens. I’m a bit ashamed I didn’t know that about Array.

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

Damn, now this works for this array but still not for others, still says undefined. If you have any explanation concerning that piece of code, I would greatly appreciate it ’cause this is driving me nuts. I post you all the code :


private static const LISTS:Array = [];
private static const MAX:Array = [];

private static function _init ():void {

	LISTS['armo'] = ['leather', 'leatherHard', 'rusty', 'leatherBlak', 'iron'];
	LISTS['rang'] = ['dagger', 'axe', 'shuriken'];
	LISTS['shie'] = ['iron', 'roundIron', 'spikes'];
	LISTS['weap'] =	['stick', 'daggerWood', 'spearWood', 'swordRusty', 'daggerIron', 'swordIron']; 

        // trace return :
        // shie = iron,roundIron,spikes
        // rang = dagger,axe,shuriken
        // weap = stick,daggerWood,spearWood,swordRusty,daggerIron,swordIron
        // armo = leather,leatherHard,rusty,leatherBlak,iron
	for (var i:* in LISTS) {
		trace(i + ' = ' + LISTS[i]);
	}

	MAX['armo'] = LISTS['armo'].length;
	MAX['rang'] = LISTS['rang'].lenght;
	MAX['shie'] = LISTS['shie'].lenght;
	MAX['weap'] = LISTS['weap'].lenght;

        // trace return :
	// shie = undefined
        // rang = undefined
        // weap = undefined
        // armo = 5
	for (var i:* in MAX) {
		trace(i + ' = ' + MAX[i]);
	}

In what damn world some of those value are undefined while ‘armo’ is ok? 8@
I have found another way to do this, and that works. But I’m dying of curiosity why this isn’t working.

Thanks

 
Flag Post

Topic: Game Programming / New programmer considering Unity3D

Here is a link which explain the opposite of what I said above :
http://gamasutra.com/blogs/LarsDoucet/20140318/213407/Flash_is_dead_long_live_OpenFL.php
Very interesting.

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

Thanks for your answer, actually I didn’t figure it out until now, so your explanation was useful and it works now.

Adding Array() around LISTS[‘armor’] was just a way for me to ensure the compiler that there was another array at this index. At least I thought it was okay to do that. But now you’re explaining that it actually create a new array ?

I’m a bit confused, so if write something like :


var myClip:MovieClip = MovieClip(myContainer.getChildAt(5));

That will creates a MovieClip ? Instead of simply force the child to be a MovieClip ?

Thanks again.

 
Flag Post

Topic: Game Programming / New programmer considering Unity3D

Since nobody actually answered your question, here’s my opinion =>
Until now Flash had the great advantage to be the only really fast and simple way to build small/medium games. Now Unity offers a similar way of working (friendly UI, lots of tools), but Unity comes with its own Engine which is way more powerful and reliable that Flash’s. Plus, Unity games can go on many platforms (web, PC, consoles, mobiles, etc.). And finally, Unity is getting big and growing, while Flash is on the contrary kind of going down. HTML5 replaced it on YouTube and Unity games start to be all over the place. That’s not good sign, even though I think Flash has still nice years ahead.
I’m sure some people will find inaccuracies in my post, so I encourage them to go further from there. Good luck with your simple RPG!

 
Flag Post

Topic: Game Programming / Troubles with Array lenght!

Yeah, I know how this must sounds stupid but I’m actually having troubles figuring this out:

I have an array LISTS which contains another array :
LISTS[‘armor’] = [‘iron, ’steel’, ‘gold’];

trace(LISTS[‘armor’]) ==> iron,steel,gold (obviously…)
trace(Array(LISTS[‘armor’]).length) ==> 1 !! How crazy is that?

So I used a temp var like that :
var array:Array = LISTS[‘armor’];
trace(array.lenght) ==> 3. (So that works)

But that’s not convenient because I have a bunch of other arrays like that. Would anybody have an idea about why the first option doesn’t work? That would help :)

Thanks for reading.

 
Flag Post

Topic: Game Programming / Daily Connection Tracking

Thanks for your answer. Actually I’m not too worried about SharedObject hackers. Because they are a few, and whatever we do, they will always find a way to break into the save file. So if I had a safe way to get the real date, I would reward the player, save a SO, and nevermind of hackers. But ==> I looked around about retrieve date on external server but each time I find an answer it implies using php on your own web page, which is out of purpose…

Just by curiosity, I’ve checked on “Pingu The Ping Idle Rpg” here on kong, I modified my pc clock, and I got multiples daily rewards… So maybe if a 1M played game use Date class, I could use it too….

 
Flag Post

Topic: Game Programming / Daily Connection Tracking

Hi there,

I’m trying to add a “Daily Connection Reward” feature in my next game, but I’m not sure how I could do that. I’ve been thinking about using a sharedObject to save last connection date, but it would be very easy to hack by simply changing the computer clock…

Would you know if there is a way to do that without having a private server to stock data ? Maybe use an external API, a public server… ?

Thanks for reading, I appreciate any suggestions.

 
Flag Post

Topic: Game Programming / Looking for testers!

Well, just subscribed, not sure where I can’t find the game and actually test it ?

 
Flag Post

Topic: Game Programming / Keys config survey

Yep that sounds like the best thing to do. Thanks.

 
Flag Post

Topic: Game Programming / where's the problem?

Just check that your Enemy class constructor takes two parameters. I’m pretty sure it doesn’t.

 
Flag Post

Topic: Game Programming / Keys config survey

I first thought you were mentionning Dvorak the composer, I really didn’t see the point. So I checked on google and I discovered a new kind of keyboard :) Didn’t think about QWERTZ either. Thanks.

Nice idea with 1, 2, 3 keys. That would be a logical solution. However, in the previous episode when I defined “D, F, G” for the default controls because it was common to QWERTY & AZERTY, everyone started to ask “why such weird controls” ! Players don’t like to be disturb in their habits…

Anyway, I’ll make sure everyone is aware that he can customize controls as he wish :)

 
Flag Post

Topic: Game Programming / Keys config survey

Okay, thanks for the answers. I will try to add the configure option in the choice as well.

 
Flag Post

Topic: Game Programming / Keys config survey

Hey, nice to hear from you Ace_Blue,

Glad you confirm that JKL and Space are fine with WASD.
For sure you’re right but I’ll just do my best so most players will not have to whine. (what’s wrong about AZERTY crowds ? ;p)

Thanks for your answer

 
Flag Post

Topic: Game Programming / Keys config survey

They are already, you can change every keys in the option menu. But players who complained didn’t check the options. That’s why I want to give them a fast choice at the beginning of the game between two nice control schemes.

 
Flag Post

Topic: Game Programming / Keys config survey

Hi guys,

In a very dynamic action game, with 4 keys for moves, and two actions keys, I think the most common config would be :

- UP, DOWN, RIGHT, LEFT : move
- Z : action1
- X : action2

But lot of people asked for WASD controls, so what actions keys would you prefer for a WASD config ? J & K ? O & P ? others ?

Thanks for reading

 
Flag Post

Topic: Game Programming / Find the error

@ BobJanova : B3 is just a graphic class, automatically made by Flash.

There is no error in the EnemyBox code, it has always worked fine in the previous episode of the game.

Got some news, I hunted and deleted all the elements which thrown this kind of error. Now the sequence is fine, but after a while, everything in the sequence still goes crazy for no reason WITHOUT even throwing an error. I have a problem down there and the error displayed is clearly not the real cause.

Let’s hunt the ghost bug… such a nice week-end is waiting for me.

Thanks for your help guys.

 
Flag Post

Topic: Game Programming / Find the error

The interval delay between sequences ends and dispatches the event so another sequence can be created.

 
Flag Post

Topic: Game Programming / Map movement slows game down =/

I’m clearly not the expert here regarding tiles and maps. But, here are a couples of notes which might help you :
Most of the time in Flash, lags come from vectorial graphics… If you use vectorial graphics for your tile, you have to cache them as bitmap. Simply use “myMovieClip.cacheAsBitmap = true;” when you create your tile. That said, be carefull, once your clip is cached as a bitmap, if you change its size or his rotation, it won’t be cached anymore. Hopefully, you are allowed to change its x and y properties. This is a very powerful way to optimize fps.

Personal and subjective comment : I never use more than 30 fps in my games. The reason ? Passed 30 fps they always get laggy due to massive use of graphics :)

Good luck

 
Flag Post

Topic: Game Programming / Find the error

Thanks for the quick answer.

At line 49 of SequenceManager, in the function _createSequence(), I instantiate the sequence. So at this exact moment, the enemyBox which is in that sequence throws the error. But if i’m not wrong, enemyBox is not a class created by the compiler. Sure, it’s already in the sequence, it’s not dynamically instantiated, but it’s bound to a Class EnemyBox that I’ve made myself.

Thanks for the 7, I wasn’t sure it was a line. Unfortunately, at line 7 in EnemyBox there is just : import src.characters.enemies.*; which makes no sens.