What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
For a game I’m making, I want to implement a mechanic so someone can click on a sprite and edit certain pieces of info. If you have ever played any of the Bloons TD games, it’s like that, where you click on the sprite and you get a menu at the bottom, where you can edit information about it, such as buying upgrades or “selling” the sprite.
How can one accomplish this? I’m using FlashDevelop and Flixel right now. I believe FlxExtendedSprites are clickable, but here are some questions I have about how to make the clicky part work properly:
-How can I initiate a menu thing at the bottom of the screen when clicking the sprite (should I just “playstate.add(menuthingy)” it in?)
-How can I make the menu disappear when the mouse clicks somewhere else? (should I just “playstate.remove(menuthingy)” it?)
-How can I make it so I can only change the angle of the sprite that is currently selected? (The sprites I want to select are lasers and mirrors, and I want to make it so I can edit only one of their angles at a time so that every single one isn’t being edited at once).
-I have FlxGroups for my lasers and mirrors, should I combine them into one big FlxGroup to make the editing of one sprite at a time easier?
Thanks very much for your help!
> *Originally posted by **[Plasmatic429](/forums/4/topics/324076?page=1#posts-6815996):***
> -How can I initiate a menu thing at the bottom of the screen when clicking the sprite (should I just “playstate.add(menuthingy)” it in?)
> -How can I make the menu disappear when the mouse clicks somewhere else? (should I just “playstate.remove(menuthingy)” it?)
appear: menuthingy.visible = true;
disappear: menuthingy.visible = false;
Of course you need to have created the menuthingy or the program will crash, and added it to the display list or you won’t see it no matter how visible it is. But you knew that.
As far as the other two questions go: If ‘angle’ is a property of the sprite object, having a different instance of the class for each of them will ensure that you can change the angle of one without changing the angle the angle of any other. And for the last one sorry, I have no idea what a FlxGroup is. I suppose it’s got something to do with Flixel. Good luck.
I’m trying to do something reasonably similar…
Would a solution such as this work?
var targ:Sprite = event.target;
if(targ as Guy!=null)//target is a guy
else if(targ as Building!=null)//target is a building
}`I’m not too familiar with how to work with objects of the same base class, but of different extended classes.