Recent posts by Anomandaris on Kongregate

Flag Post

Topic: Game Programming / compering numbers

I don’t know the specific unity code but the solution is:

1) put the players into an array
2) sort the array by their failposition in ascending order
3) for each player add their index in the sorted array to their score.

 
Flag Post

Topic: Game Programming / Programming and working

DealMaster13 that’s an insane schedule, I have no idea why I’m even seeing you in lectures this year… Why haven’t you cracked up yet?

 
Flag Post

Topic: Game Programming / Help with this bloody button?

Within your “new MouseListener()” declaration you need to override public void mouseClicked(e:MouseEvent) and put your code in there.

See the oracle docs for an example
http://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html

 
Flag Post

Topic: Game Programming / How to print lines slowly in Java?(and a few other questions)

Don’t know anything about the GUI of netbeans but to print out a line one second at a time:

try
{
String [] strings = ....; 
for(String s : strings)
{
Thread.wait(1000);
System.out.println(s);
}
catch(InterruptedException e)
{
System.err.println("Interrupted!");
}
}
 
Flag Post

Topic: Game Programming / Board game.

If and when you get on to AI give me a message and I’d be happy to help. I was the sole entrant to this board’s abortive Gomoku AI competition two years ago. Strangely enough mine won :)

 
Flag Post

Topic: Game Programming / How to do A RPG Turn Based Flash AS3

Originally posted by Ace_Blue:

Try this:

var MyGame:flash.games.RPG;
MyGame = new RPG(); // No need for parameters at creation, you can customize later.
// Customization
MyGame.quality = RPG.AWESOME;
MyGame.badges = true;
MyGame.money = Sponsorship.money.LOTS;

Good luck.

Hate to nitpick but there’s at least one syntax error in that, I think you mean


var MyGame:flash.games.RPG;
MyGame = new RPG(); // No need for parameters at creation, you can customize later.
// Customization
MyGame.quality = flash.games.RPG.AWESOME;
MyGame.badges = true;
MyGame.money = Sponsorship.money.LOTS;

You never imported flash.games.RPG :)

 
Flag Post

Topic: Game Programming / help plz

Originally posted by Senekis93:
Originally posted by Anomandaris:

A little mean, no? :P You could have just said no :)

It’s not as satisfying.

Fair enough! Though you’d better upgrade your burglar alarm for when he comes round to hit you on the head with the smoking remains of his laptop…

 
Flag Post

Topic: Game Programming / help plz

A little mean, no? :P You could have just said no :)

 
Flag Post

Topic: Game Programming / Propagate activation up class heirachy (solved oh so quickly!)

Oh yes, sorry that’s so obvious! Completely silly moment there… Cheers!

 
Flag Post

Topic: Game Programming / Propagate activation up class heirachy (solved oh so quickly!)

Just fishing for bright ideas here! I have a fairly standard heirachy of classes, for example, fighter extends ship extends battleObject and each one has its own set of tasks to do when activated i.e. added to the battle.

Any ideas on how to get the fighter function “activated” to call the corresponding “activated” in ship and in battleObject?

They all do different things relevant to that level in the heirachy and hence I don’t actually want to override them…

 
Flag Post

Topic: Game Programming / Reducing lag with lots of on screen objects? (AS2)

I’ve known about this for quite a while but I’ve never thought of an effective way to implement it. In particular how to keep track of all the functions to call from the single enter frame method. Pushing them all into an array is fine except when you want to remove the object how would you find their functions to remove?? Any suggestions?

 
Flag Post

Topic: Game Programming / What is the best way to implement a singleton.

I can only change the instance at run time, right? So I would still need to pass the instance of the singleton class.

No you can change them any time you want. You’re getting static confused with const. And with the code above you don’t have to initialise the Singleton class or pass it in any way.

 
Flag Post

Topic: Game Programming / Termination EventListener

But if the user’s just bought an expensive and rare item and then casually exits assuming autosave 5 seconds later, he’s lost it…. Trust me it happens to me all the time.

 
Flag Post

Topic: Game Programming / Termination EventListener

Hmm thanks although that’s what I was trying to avoid in the first place… Auto-saving is such a pain, sprinkling Data.saveData() absolutely everywhere in your project is sooo ugly.

 
Flag Post

Topic: Game Programming / What is the best way to implement a singleton.

If you’re just trying to access variables then the solutions above are overcomplicating things. All you need is to declare the variables static in the global class and then you can access them like below.

class Singleton
{
    static var _someValue1:int;
    static var _someValue2:int;
}

class Whatever
{
    public function something():void
    {
        var newValue1:int = Singleton._someValue1;
        var newValue2:int = Singleton._someValue2;
    }
}

 
Flag Post

Topic: Game Programming / Termination EventListener

Yes but I want to update the SO first….

 
Flag Post

Topic: Game Programming / Termination EventListener

Does anyone know of anyway to detect when the swf is terminated? e.g. some sort of event listener…..

Obviously this would be very useful for saving as it would mean you wouldn’t have to save everytime the player does the tiniest thing, just save when they leave the page. I’ve looked around on the big wide net and come up with a blank.

 
Flag Post

Topic: Game Programming / Isosceles Right Triangle

Oh apologies, I misunderstood the significance of “right” triangles!

Yes you then need the cosine rule to check if the angle between the two short lengths is 90.

 
Flag Post

Topic: Game Programming / Isosceles Right Triangle

Just find the the square of the lengths (going for efficiency here!) between the points using pythag.

Evaluate
(x1-x2)^2+(y1-y2)^2
(x1-x3)^2+(y1-y3)^2
(x3-x2)^2+(y3-y2)^2

If its isosceles two of them will be the same and the other won’t! Simples!

 
Flag Post

Topic: Game Programming / A true looping map

Soooo simple! That’s such a help, thanks!

 
Flag Post

Topic: Game Programming / A true looping map

I’m interested in creating a looping map for my game and am completely stumped for efficient/simple ideas! And yes before you say that’s easy, the following (with some looping terrain) isn’t quite what I’m looking for!

if(object.x > limit)
{
      object.x = 0;
}
The idea is when you come to the boundary of the square map you can see what’s going on the other side of the map i.e. the moving objects on the other side of the map will appear on the screen as being next you. In practice this should make the boundary undetectable by the player. An example of this Azul Baronis (completely epic game!).

http://www.kongregate.com/games/AndrewMartin/azul-baronis?acomplete=azul+baro

My first approach was to create images of all the moving ships and get them to mimic the motion of the real ships and place them on the edges of the square.

copy copy copy
copy real copy
copy copy copy

Unfortunately you need nine copies and corners are a real pain requiring three copies each and needing to get information from three different regions of the map! In addition the code managing when and where the copies appeared was even more complicated than the game itself. So basically this was completely unworkable not to mention horribly laggy

Next was trying to create bitmaps of the entire map and place them adjacent to the map. Needn’t tell you how much lag this generated creating them every frame!

So I’m out of ideas! How would you guys go about creating something like this?

 
Flag Post

Topic: Game Programming / Senocular KeyObject WIDGX

The Flash player you get with Adobe’s IDE has some built in shortcut keys which override other keypresses. You can turn them off somewhere in the menu (in the flash player, not the IDE).

Okay I must be being slightly dense here, apologies! I’m working in CS3 and I’ve turned off the keyboard shortcuts that come using it via “Edit” then “Keyboard Shortcuts…”. I’ve also started my movie and in the Flash Player gone to “Control” and then checked “Disable Keyboard Shortcuts”.

Unfortunately this hasn’t had any effect… was that what you meant? If not how do you access the Flash Player settings directly?
 
Flag Post

Topic: Game Programming / Senocular KeyObject WIDGX

Hmmm this problem appears to be more general than I initially made out. Its not anyone’s class that’s the problem, its actually the whole KeyListener thing. KeyListener.KEY_DOWN doesn’t detect anything other than those 5 letters…

If this is what you meant, could you elaborate how to disable the keyboard shortcuts CuriousGaming?

Anyone else have any ideas?

 
Flag Post

Topic: Game Programming / Senocular KeyObject WIDGX

This is a wonderful class and I’m sure everybody’s heard of it! Unfortunately I’ve been experiencing some problems with detecting letter key presses.

I’ve inserted a trace statement in the KeyReleased function which should just trace the keycode when any key is released. It works for all the Keyboard. keys e.g DOWN,LEFT,ENTER etc. but the only letters it picks up are “W”,“I”,“D”,“G” and “X”. Anything other letter it just ignores and never picks up when they’re either pressed down or released….

Anyone else encountered this problem?

 
Flag Post

Topic: Game Programming / AI Programming Contest #1 Gomoku

Originally posted by jonathanasdf:
Originally posted by Anomandaris:

The program works fine now, absolutely nothing wrong with that! Its just that every time a new game starts I have to press cancel half-a-dozen times in that box to get it to play!

How are we submitting the swfs HensHouse?

Oh, so did you try compiling YOUR AI with debug off?

That’s a very good point, I’m going to feel really stupid if that’s the case! Its too late now, I’ll fiddle around with the settings of my swf in the morning…