roofy
10-24-2006, 03:16 PM
Hi there,
It is now time for me to start on my second project in my fundementals of programming class. I thought of creating a ring toss game but there is one problem I am having. When I create a mouse clicked on something event, and I pass the "mouse under the object" to my parameter of my custum event handler, alice is passing the wrong object. What I want Alice to do is say this
**********************************************
Event: when the mouse is clicked on anyobject
Event handler: prepareToss(mouse under the object)
parameter: mouseObject
do in order
if mouseObject == ringToss.bottle2 then
call ring.tossRing(mouseObject)
**********************************************
**********************************************
method ring.tossRing
parameters: mouseObject
do in order
have camera turn to face mouseObject
have ring move to mouseObject
**********************************************
now what this means, and if I am correct, is the ring.tossRing method should be called only if the clicked object is ringToss.bottle2. However, when I tested it, by clicking on bottle2, nothing happens. I then tested the parameter by putting it inside a print construction, and here I found out that no matter what bottle I click on, mouseObject parameter is always being passed as world.ringToss. So in other words, if I click on bottle1 the mouse result pass as world.ringToss, and if I click on bottle2, the mouse result would pass as world.ringToss, and so on.
So my question is, since it seems like Alice does not like passsing children of the main object, is there anyway I can have Alice to ignore the parent object and go straght to the child object?
It is now time for me to start on my second project in my fundementals of programming class. I thought of creating a ring toss game but there is one problem I am having. When I create a mouse clicked on something event, and I pass the "mouse under the object" to my parameter of my custum event handler, alice is passing the wrong object. What I want Alice to do is say this
**********************************************
Event: when the mouse is clicked on anyobject
Event handler: prepareToss(mouse under the object)
parameter: mouseObject
do in order
if mouseObject == ringToss.bottle2 then
call ring.tossRing(mouseObject)
**********************************************
**********************************************
method ring.tossRing
parameters: mouseObject
do in order
have camera turn to face mouseObject
have ring move to mouseObject
**********************************************
now what this means, and if I am correct, is the ring.tossRing method should be called only if the clicked object is ringToss.bottle2. However, when I tested it, by clicking on bottle2, nothing happens. I then tested the parameter by putting it inside a print construction, and here I found out that no matter what bottle I click on, mouseObject parameter is always being passed as world.ringToss. So in other words, if I click on bottle1 the mouse result pass as world.ringToss, and if I click on bottle2, the mouse result would pass as world.ringToss, and so on.
So my question is, since it seems like Alice does not like passsing children of the main object, is there anyway I can have Alice to ignore the parent object and go straght to the child object?