Does this make sense
by rennie moffat · in General Discussion · 08/06/2009 (7:40 pm) · 5 replies
I am trying to code, I am a rook to the nth degree. however, what I am wondering is does this code make sense?
The reason I ask is becasue onLevelLoaded I want my playerClass (cube) to use mouse events to determine its movement, where it will go, so "set" (true), I would think "get" should be involved to, as it must retrieve the event info. Am I right?
The documentation, they are defined as follows...
setMouseEvent: Sets whether or not mouse events are monitored by this object.
getMouseEvent: Gets whether or not mouse events are being monitored by this object.
function cube::onLevelLoaded(%this, %scenegraph)
{
$cube = %this;
%this.setUseMouseEvents(true);
%this.getUseMouseEvents(true);
}The reason I ask is becasue onLevelLoaded I want my playerClass (cube) to use mouse events to determine its movement, where it will go, so "set" (true), I would think "get" should be involved to, as it must retrieve the event info. Am I right?
The documentation, they are defined as follows...
setMouseEvent: Sets whether or not mouse events are monitored by this object.
getMouseEvent: Gets whether or not mouse events are being monitored by this object.
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
08/06/2009 (8:05 pm)
would you be able to give me an example of where one might use getMouseEvents?
#3
`Patrick
08/12/2009 (12:37 pm)
function cube::onLevelLoaded(%this, %scenegraph)
{
$cube = %this;
if(!$cube.getUseMouseEvents())
{
%this.setUseMouseEvents(true);
}
}So this will check if $cube is using mouse events and if it's not ( ! ) then it sets it so it is.`Patrick
#5
So...
if $cube is not using mouse events then set it to use mouse events.
08/12/2009 (1:33 pm)
because getUseMousevents() returns a value. Either true or false, depending on if the mouse events are enabled on that object.So...
if $cube is not using mouse events then set it to use mouse events.
Torque Owner Vijay
Dirisoft LLC