-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report: FlxMouseEventManager doesnt work on codename #371
Comments
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. |
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. |
99% sure the reason why its broken in CNE is because the Flixel branch they custom made for CNE was outdated (This i know because of a UIState bug that pissed me off 😭) and It works in original YoshiCrafterEngine, and very old (like first 100 commits) CNE because it was using updated Flixel branch. @NeeEoo might want to check flixel branch and see why |
[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?
The text was updated successfully, but these errors were encountered: