Mouse Input not working.
by Dillon Sinnott · in TGB Platformer Kit · 05/30/2010 (8:12 pm) · 4 replies
It seems like whatever mouse controls I try to use don't work. Even adding behaviors like MouseDraggable to objects doesn't work (yes I have useMouseEvents enabled) doesnt work.
Doesn't Work:
function t2dSceneWindow::onMouseDown(%this, %modifier, %worldPos)
Doesn't Work:
function SomeObjectsClass::onMouseDown(%this, %modifier, %worldPos)
Basically anything that has to do with the mouse that isn't the normal fireball attack (Which I have commented out in place of another attack) thing doesn't work.
I assume this has something to do with the fact that the mouse gets hidden during gameplay, however the function FollowMouseEx does work, so it's really confusing.
Help would be greatly appreciated, I'm really stuck on this one, doesn't seem to make much sense.
Doesn't Work:
function t2dSceneWindow::onMouseDown(%this, %modifier, %worldPos)
Doesn't Work:
function SomeObjectsClass::onMouseDown(%this, %modifier, %worldPos)
Basically anything that has to do with the mouse that isn't the normal fireball attack (Which I have commented out in place of another attack) thing doesn't work.
I assume this has something to do with the fact that the mouse gets hidden during gameplay, however the function FollowMouseEx does work, so it's really confusing.
Help would be greatly appreciated, I'm really stuck on this one, doesn't seem to make much sense.
#2
I did exactly what you did in the demo level (the one on TDN) and all the two layers did was sit there.
Correct me if I'm wrong but if I add a Parallax Scroller behavior to a scroller, then set the X and Y rates to say .75, there's no reason it shouldn't move, right? It's not any more complicated then that... But then I looked at your demo level (that comes with the kit, not the TDN one) and noticed there are no parallax scrollers there (in the in-game editor), and that you're using some other method that you explain in the TDN page. I don't really want to go through that though, I'd just like the Parallax Scroller behavior to work.
Not a huge deal, but it's just been bugging me, especially since I couldn't find anyone else having the problem (after searching through the forums).
05/31/2010 (9:36 pm)
I'll check it out. I just worked around it for now, and I'm running into a new problem. I can't get Parallax to work.I did exactly what you did in the demo level (the one on TDN) and all the two layers did was sit there.
Correct me if I'm wrong but if I add a Parallax Scroller behavior to a scroller, then set the X and Y rates to say .75, there's no reason it shouldn't move, right? It's not any more complicated then that... But then I looked at your demo level (that comes with the kit, not the TDN one) and noticed there are no parallax scrollers there (in the in-game editor), and that you're using some other method that you explain in the TDN page. I don't really want to go through that though, I'd just like the Parallax Scroller behavior to work.
Not a huge deal, but it's just been bugging me, especially since I couldn't find anyone else having the problem (after searching through the forums).
#3
Mouse input works in MainMenuGuiSceneWindow which is where I made my custom main options, but does not work in sceneWindow2D, which is what I need so a person playing can click on buttons while playing the game.
There is no Canvas.cursorOff unless it's in source. Any other ideas sir? I'm using PSK Pro.
06/03/2011 (11:26 am)
Hey PhillipMouse input works in MainMenuGuiSceneWindow which is where I made my custom main options, but does not work in sceneWindow2D, which is what I need so a person playing can click on buttons while playing the game.
There is no Canvas.cursorOff unless it's in source. Any other ideas sir? I'm using PSK Pro.
#4
function t2dSceneWindow::onMouseDragged(%this, %modifier, %worldPosition, %clicks)
Will work now. The problem I wonder is within sceneWindow2D let's say I have a graphical button within the level and I want a player to be able to click on it, how would that work?
Note that when MainMenuGuiSceneWindow is loaded you can simply use the generic button behavior, but you can't within sceneWindow2D. My guess is because all clicks within sceneWindow2D are being referenced for function t2dSceneObject.
07/22/2011 (8:24 pm)
Upon further review, once you load sceneWindow2D then you can start loading events with t2dSceneWindow.function t2dSceneWindow::onMouseDragged(%this, %modifier, %worldPosition, %clicks)
Will work now. The problem I wonder is within sceneWindow2D let's say I have a graphical button within the level and I want a player to be able to click on it, how would that work?
Note that when MainMenuGuiSceneWindow is loaded you can simply use the generic button behavior, but you can't within sceneWindow2D. My guess is because all clicks within sceneWindow2D are being referenced for function t2dSceneObject.
Associate Phillip O'Shea
Violent Tulip
function startGame(%level) { ... // Disable the mouse Canvas.cursorOff(); ... }Remove that line and that might do the trick. Let me know if it doesn't though.