Alice Community  

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

Reply
 
Thread Tools Display Modes
clean up the events window
Old
sibhod
Guest
 
Status:
Posts: n/a
Default clean up the events window - 09-29-2007, 03:24 PM

As you read this, keep in mind this is my first time using Alice or any other OOP program. Really the only program that I mess around with is Anim8or, which is not anything like Alice, so I am new to the entire concept.

For my intro to comp. science class we were instructed to make a flight simulator. Well I have no problem with that, I made a controllable seaplane, but right now ALL of my controls stem from the Events window, and none come from methods.

Is that a bad way to go about this project? My commands for example are,

"While <-- is pressed
Begin: <None>
During: <Navy Jet, Turn, Left, 0.1 revolutions
End: <None>"

and I basically have multiple things like that for turning left, and right, Rolling left and right (with A and D) turning 'forward' and 'backwards' (lower and raise the nose of the plane) and one to speed up while W is held

For speeding up I set the plane to move forward 100 Meters over a duration of 50 seconds- was that a good way of doing it?

Back to my point. I have at least 10 Events all cluttering up the Event window. My question is Should I have created it like that? Or was there a more simple way to implement the controls/commands?



I also have another question about Functions. I can use the proximity commands "navyjet is within threshold of object" and "navyjet is at least threshold away from object" with Conditional Statements in the Events window, and I literally just now figured out where I can put the functions like "navyjet distance to" or under Spatial Relation, "navyJet is above"

How do I set something up so that it will do something like a check to see that the navyJet is 1 meter above the carrier, orientated to the carrier, and also because I'm guessing that if I just had "while navyJet is 1 meter above carrier...." that it would act upon the jet no matter where it was as long as the y value distance of jet to carrier was 1 meter... like x,1,z.

Basically I want that check so that it will cause the jet to stop e.g. land on the carrier, and from that point I would have.. another event? to set the navyJet's vehicle to the carrier causing them to move as one.


Edit: I also forgot to ask how to cause the navyJet to stop. Other than predetermining things for Movies, I haven't had to cause something to completely come to a halt so I would like something that when I press 'Q' the navyJet will completely stop and preferably return to being parallel with the carrier and world (ocean scene). Right now it starts out parallel (or as much as it can be via the rotate, turn, resize controls from the Add Objects screen

Last edited by sibhod; 09-29-2007 at 03:35 PM.
   
Reply With Quote
Old
islandfever
Guest
 
Status:
Posts: n/a
Smile 09-29-2007, 07:36 PM

For the last part, try a variable number value that is called "speed". Replace any values of speed you already have with this. Then, make its value whatever you want at the beginning, and when you use a speed boost be sure to make "speed" equal 100 (meters). Now, have

"When Q is pressed : <speed> set value to <0>"

Also, when you want your airplane to become parrallel; use the Stand-up method under standard methods of the airplane. Therefore, your final "Q" will look like this:

"When Q is pressed : {Do Together}
[<speed> set value to <0>]
[Navy Jet <stand up>]
}"

Hope that helped!

PS Your way of organizing isn't any worse than using methods. Try Comments, though, to explain what that action will do.

Last edited by islandfever; 09-29-2007 at 08:11 PM.
   
Reply With Quote
Old
islandfever
Guest
 
Status:
Posts: n/a
Default 09-29-2007, 08:10 PM

OKay, I've constructed a simpler version of what I think yours is. This will probably help clarify what I said. Be sure to look at my airship's variables!
Attached Files
File Type: a2w Airplane Example.a2w (211.0 KB, 240 views)
   
Reply With Quote
Old
sibhod
Guest
 
Status:
Posts: n/a
Default 09-30-2007, 01:40 AM

ok so i checked out your example which was very much appreciated by the way, but i dont really understand how you created the variable "T/F Stopped = false" under the navyJet. and because of that i dont understand how you made the
"navy.Jet.Stopped, set value to, True/False"

though is it actually THAT line that causes the jet to stop? or is it the "navyJet.speed set value to 0 duration= 1 second style= abruptly"

oooorrr are those working in conjunction because they are in a Do together..


Ok so with a bit of trial and error i changed my beginning from a "when world starts run method GO!!" or whatever in which case GO was "navyJet move forward 1000 meters duration 120 seconds" looped infinitely, and btw thats how I was doing my turbo speed thing. i used the "while W is pressed move navyJet forward 1000 meters..." but i set the duration lower so it moved faster. Your way is a lot cleaner though so thankyou.

in your turbo boost, where did you get the "Wait #Time"? and can you only use Wait in Events like the Functions?

ok I also just got the Speed changes to work W for turbo and S to slow down (make it easier to land), but i can't get them to be a gradual change. I did:

While 'S' is pressed
begin: navyJet.speed set value to 3.5
during: <None>
end: navyJet.speed set value to 10

And i did the same concept for the turbo, so if you could explain how to make that a gradual change, that would be appreciated, and even more so if you could explain it and involve how to edit the duration it takes to complete the change or whatever.

Finally the Biggest problem I am having is the Camera.. I have tried MANY different things for trying to get it to follow my plane and i currently only have 1 that is working Almost how i would like it. Unfortunately i dont remember what i did for it and it's on the computers at school which i wont be able to use until monday, but i have tried different combinations of:

While Space is pressed
begin: *Do Together*- "get a good look at" "turn to face" or "point at" (i tried those separate from each other, but all in conjunction with) "move to navyJet"
during: <none>
end: <none>


I dont remember if i put it in the Begin, or During because i have scrapped all attempts at it, but i do know that if i use Point at and Move to and hold space too long it crashes into the plane and causes an error in which the next time i run it, the plane and camera will continue to act as though i were still holding down some keys so i have to press them all to stop it...

I have also been trying to figure out how to implement something like:

While Space is pressed
Begin <none>
during: If [camera] is within [10 meters] of [navyJet]
Do Together: [camera] turn to face [navyJet]
[camera] move to [navyJet]
Else: (Just tried it with the same statement used for the IF and it worked kind of..)


That kind of works, but I would also like to have it Not go too close so would i have to put that Entire thing from "while space is pressed" and branched down ALL into some kind of IF statement? If so i have no idea how so could you please explain that?



Sorry if thats all really jumbled, i took long pauses in the message to try random ideas that popped into my head, but any questions of mine that you see and can answer without consuming too much of your time would be greatly appreciated.



Edit: OK I'll leave all that up there just in case, But i figured out something good with the camera. It's set to

while space is pressed
begin <none>
during: If [camera] is within [20 meters] of [navyJet]
Do Together
[camera] turn to face [navyJet.cockpit] [style = gently] (not sure if style helped
[camera] point at [navyJet.cockpit]
[camera] move at speed [forward] [speed = 10 meters per sec]

Else - Nothing
End <none>



and that is really good except for the camera lags behind the plane on turns juuuust a bit

now i just need to edit the turbo and slow for the jet to include the camera so that it does not overlap the plane, but i'm not sure if it will work by changing the line to a "Do together" and then include the lines exactly as i put them for Space except with different #'s for SPEED. I would try that but i am very tired and so i'll just wait for your response tomorrow

Last edited by sibhod; 09-30-2007 at 02:02 AM.
   
Reply With Quote
Old
islandfever
Guest
 
Status:
Posts: n/a
Talking 09-30-2007, 11:07 AM

Creating True/False variables is what I do a lot to solve problems and stop "glitches" from occuring in a game. To create one you would hit "Create new variable" and then hit the bullet that says Boolean. You then select a value (true or false) and name it. If you're wanting it to become true (or false, depending on the coding) you would just drag the variable onto an open code line and select true (or false).

"T/F Stopped = False" is saying that the airship is moving. But when you hold down a certain button, it becomes true. Thus, you can't move in a speed boost. Here's an example:


{{
[[When <Enter> is pressed]]
[If <airplane.Stopped> = <False>]
<airplane.Speed> set value to <50>
wait <3 seconds>
<airplane.SPeed. set value to <25>

[Else]
Do Nothing
}}

This way, while you're moving, you can do a speed burst; but when your airplane.stopped = True you can't. This prevents any bugs occurring or otherwise. Therefore, to answer to your main question, T/F Stopped = False affects the original value while "navy.Jet.Stopped, set value to, True/False" affects what the value will be; so both values are put into effect.

"navyJet.speed set value to 0 duration= 1 second style= abruptly" is the actual value though. The True/False's just "placehold" (sorry its hard for me to explain.) and secure what will happen in an event.



"Wait" is in the method code selection, at the bottom of the method code viewing block. IT's the same place you get "do together", "If/Else", etc. It is in between "For All Together" and "Print". Jusyt drag and drop and choose the time!

I'm not exactly sure about your gradual change problem, but I think all you need to do is make the style "abrupt" and set the duration to a higher value.


One question, are you wanting your camera to look at the ship at the press of a button or do you want it to follow the ship just without button pressing? If the second one, under Properties of the camera select the scroll down of vehicles and select to airplane. I'll post a picture soon explaining that.


If you still need help, just ask! I'm glad to help in any way.
   
Reply With Quote
Old
islandfever
Guest
 
Status:
Posts: n/a
Default 09-30-2007, 11:25 AM

Here shows where "vehicles" is.
Attached Images
File Type: jpg Alice Help vehicle.jpg (14.1 KB, 89 views)
   
Reply With Quote
Old
sibhod
Guest
 
Status:
Posts: n/a
Default 09-30-2007, 01:51 PM

in the requirements for the project it said something like "when space is pressed the camera re frames to see the plane again" so i need it to happen when i hold space.

i did try using the vehicle in class on friday,

while space is pressed
begin: set [camera] vehicle to [navyJet]
during <none>
end: set [camera] vehicle to [world]


but that doesnt work out very well because the camera would have the be in a 1st person view of the plane, otherwise it would be like:


----- ------- -----/ -------/ | |


in which the left one is the camera and right is the plane, and they would get the a point where they are both orientated the same way so the plane is not in view. At least thats the problem that it gave me about 3 seconds after i tried it.


Ok i'm just plain not sure how to do this. I can't make a variable for Camera speed because then i can't get it to follow the plane.

because of that, i can't make T/F commands to check If [navyJet] is moving [20 meters per second] True; Then Set camera speed= 20

or something like that, and so i cant do it for the slow speed either
   
Reply With Quote
Old
sibhod
Guest
 
Status:
Posts: n/a
Default 09-30-2007, 01:53 PM

I'll go ahead and attach what i have done so you dont have to look at my crappy examples anymore
Attached Files
File Type: a2w flight simulator.a2w (262.4 KB, 245 views)
   
Reply With Quote
Old
islandfever
Guest
 
Status:
Posts: n/a
Default 10-01-2007, 02:24 PM

Oh Oh!!!!! Thanks for posting your game, I think I found the answer!!!! Also, I changed your game to fit the new coding.

What I have is this:

{While <space> is pressed:

Begin: <Do nothing>

During: [[Do In order:
<camera> set point of Veiw to <dummy> Duration=0 seconds
<camera> set Vehicle to <dummy> Duration=0 seconds]]

End: <camera> set vehicle to <world> Duration=0 seconds}


YOur probably wondering what the "dummy" is, and where I got it. A dummy is pretty much a placeholder. When you click "add objects", go down to "more controls". Click "Drop Dummy At Camera". It is automatically where you're camera's at, so I used set camera's point of view to it because it is already facing the navyjet. I made the dummy's vehicle to the Navy Jet so it continually follows and faces it, that way Point of Veiw moves the camera striaght behind it.

Also, 0 seconds duration ensures no mistakes in timing. I hope this solves your problem!
Attached Files
File Type: a2w flight simulator with Dummy.a2w (262.4 KB, 236 views)

Last edited by islandfever; 10-01-2007 at 02:25 PM. Reason: A dummy is pretty much a placeholder.
   
Reply With Quote
Old
sibhod
Guest
 
Status:
Posts: n/a
Default 10-02-2007, 12:27 PM

ehh i've already tried something like that. I made mine like

while space is pressed:

begin: set [camera] vehicle to [jet]
during<none>
end: set [camera] vehicle to world

but the thing is when you turn and stuff it looks kinda weird with the plane constantly centered in the window. I had to print off the code and turn it in today so i just left out the turbo and break (they were not required for the grade).

Thanks for all the help though
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.