Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Questions about the event loop?
Old
Down with duke
Guest
 
Status:
Posts: n/a
Default Questions about the event loop? - 03-27-2010, 05:30 PM

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.)
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-27-2010, 09: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.
   
Reply With Quote
Old
Down with duke
Guest
 
Status:
Posts: n/a
Default 03-27-2010, 09: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: http://www.mediafire.com/?idyomjzgyyh
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 03-28-2010, 08:54 AM

If you want FPS engine, i made this a while ago
http://www.alice.org/community/showt...ghlight=aiming


If you want just orient with out clicking, i made this aobut a week ago
http://www.alice.org/community/showt...ghlight=orient
Its near the bottom of the page


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-28-2010, 10:16 AM

Quote:
Originally Posted by Down with duke View Post
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: http://www.mediafire.com/?idyomjzgyyh
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.
Attached Files
File Type: a2w gunShoot.a2w (466.6 KB, 7 views)

Last edited by rankhornjp; 03-28-2010 at 11:20 AM.
   
Reply With Quote
Old
Down with duke
Guest
 
Status:
Posts: n/a
Default 03-28-2010, 11:53 AM

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

Last edited by Down with duke; 03-29-2010 at 10:17 AM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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