Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Questions about the event loop? (http://www.alice.org/community/showthread.php?t=4147)

Down with duke 03-27-2010 06:30 PM

Questions about the event loop?
 
I am a student teacher assistant for our school's computer science class and the county has mandated that we use alice. The teacher had asked me to make an example program using alice to show to the students. However I have had some problems adapting to not using a text editor and can't seem to find how to do certain things, any help with these things would be much appreciated.

I need to clear the click event queue as when clicks happen while the firing animation is taking place they will always lag in later and make the gun continue to shoot (or I need to be able to drag conditional statements to control the event queue so when player_IsShooting is true I can ignore any unwanted mouse clicks.)

I need to set the "Let arrow keys move <subject>" to move an object in relations to another one's axis not just the object's local axis, because when the camera and gun are rotated via this procedure the gun always goes out of the camera's viewpoint (or I need to attach the gun and the camera so that they travel together as a single unit.)

rankhornjp 03-27-2010 10:29 PM

The first one, Im not sure I understand what you want.

The second one I can help you with:

click on the gun in the object tree and then click on the properties tab. The is a property called "vehicle". It is usually set to "world". Adjust the gun to where you want it in the screen and then change "vehicle" to "camera". Now when the camera moves so will the gun.

All object have this property.

Down with duke 03-27-2010 10:49 PM

Wow thanks, that worked great. But let me see if I can't explain myself a bit better on the first part...

From what I understand the "On Click" event loop captures mouse clicks and points them to a method, however, if the method the "On click" event was told to preform takes longer than it takes for the player to click agian then the event loop will make a list of that method to preform sequentially. This is bad for me because if you continuously click, the gun I have positioned wont stop shooting until it finishes playing through all of them.

If you want to see the problem for yourself I attached what I have so far: [URL="http://www.mediafire.com/?idyomjzgyyh"]http://www.mediafire.com/?idyomjzgyyh[/URL]

jediaction 03-28-2010 09:54 AM

If you want FPS engine, i made this a while ago
[URL]http://www.alice.org/community/showthread.php?t=3631&highlight=aiming[/URL]


If you want just orient with out clicking, i made this aobut a week ago
[URL]http://www.alice.org/community/showthread.php?t=4091&highlight=orient[/URL]
Its near the bottom of the page

rankhornjp 03-28-2010 11:16 AM

1 Attachment(s)
[QUOTE=Down with duke;19134]Wow thanks, that worked great. But let me see if I can't explain myself a bit better on the first part...

From what I understand the "On Click" event loop captures mouse clicks and points them to a method, however, if the method the "On click" event was told to preform takes longer than it takes for the player to click agian then the event loop will make a list of that method to preform sequentially. This is bad for me because if you continuously click, the gun I have positioned wont stop shooting until it finishes playing through all of them.

If you want to see the problem for yourself I attached what I have so far: [URL="http://www.mediafire.com/?idyomjzgyyh"]http://www.mediafire.com/?idyomjzgyyh[/URL][/QUOTE]

Are you using "bullets"? If so, you could have one bullet that returns to the gun after every shot. Then set up a function so that the bullet has to be "in" the gun before the gun will shoot. That way if the bullet is "down range" and you click again nothing will happen.

1) you would need a boolean variable set to false. Then create event: When "object" is clicked on set "variable" to "true"

2) Create another event: When "variable" is "true" and "bullet" is within 1 meter of "gun" do: "gunShoot" and "setVariableFalse"


Here is a world where I'm using the tennis ball as "bullets". See if this helps you out.

Down with duke 03-28-2010 12:53 PM

EDIT: Never mind, I figured it out thanks for the help :)


All times are GMT -5. The time now is 09:14 AM.

Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.