Open NotMrPolo-real opened 2 months ago
I haven't used FlxMouseEventManager that much, so I cannot give you an answer, but here is a solution:
FlxG.mouse.overlaps(SprOrGrp:FlxBasic, ?Camera:Null<FlxCamera>) : Bool
FlxG.mouse.justPressed(get, never) : Bool
like:
override function update(elapsed:Float){
super.update(elapsed);
if(FlxG.mouse.overlaps(spr, /*If the sprite in question is using a camera, put it here.*/)){
if(FlxG.mouse.justPressed){
// justPressedCode
}
// selectedCode
} else {
// nonSelectedCode
}
}
ty but the reason i really need the FlxMouserEventManager to work is because so when i hover(overlaps) a object(spr) it plays the scroll sound. when i try it with the normal FlxG.mouse.overlaps(spr) the sound is looped until i un-hover.
Hopefully, this works. :3c
var hasSoundPlayed:Bool = false;
override function update(elapsed:Float) : Void {
super.update(elapsed);
if(FlxG.mouse.overlaps(/* Sprite u wanna click */, /*If the sprite in question is using a camera, put it here.*/)){ // Selected
if(!hasSoundPlayed){
// Plays the sound once
FlxG.sound.play(/*soundPath*/);
hasSoundPlayed = true;
}
if(FlxG.mouse.justPressed){
// justPressedCode
}
// selectedCode
} else { // Not Selected
hasSoundPlayed = false;
// nonSelectedCode
}
}
I'm half asleep, so if it doesn't work, put the hasSoundPlayed variable inside the update function.
[X] Windows [ ] Linux [ ] Mac
i've been using FlxMouseEventManager in psych engine a lot of time and it works always but when i try it in codename it just doesnt detect or go into the functions i want. does anybody know why?