Alice Community  

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

Reply
 
Thread Tools Display Modes
Old
Samo
Guest
 
Status:
Posts: n/a
Default 06-05-2006, 06:40 AM

ok, thank you for all ur help, but i've tried everything, and still crashes the window. fortunantly, i've discovered that it only crashes when attempting to steer it with the directional arrow keys
   
Reply With Quote
code revolutions
Old
Jabberwocky
Guest
 
Status:
Posts: n/a
Default code revolutions - 06-05-2006, 06:46 PM

You have two problems that are making your world crash. One, like LanceA has said, is that the Air Raid Siren sound has a corrupt header. It's attached to the world object and the spaceship object. Delete it from both places and recreate it.

The other problem, like you've said, is the click events for the arrow keys. Change the values of the click events to some value other than "code revolutions per second"; try "0.25 revolutions per second".

The world looks neat. I'd like to see it when your done.

Did you ever get your video flicker problem fixed?
   
Reply With Quote
Old
Samo
Guest
 
Status:
Posts: n/a
Default 06-05-2006, 11:41 PM

no, fortunantly, i get enough time at school to find another problem

btw, i present it on friday, also, if i set it to .25 rps, it'll be all screwy, i'm trying to make it like the flight simulator example world so if u can tell me how i get those values for the arrow key events, plz tell me

oh, one more thing, where is the air raid siren attatched to the spaceship object?
   
Reply With Quote
Old
Jabberwocky
Guest
 
Status:
Posts: n/a
Default 06-06-2006, 12:34 PM

I did notice once that after changing the speed value the spaceship would just spin instead of joining formation with the fighters. I found that if you'll just delete the key event for the up arrow key & recreate it will work just fine.

In the flight simulator example world, the arrow-key click events are setting the speed to "turnSpeed revolutions per second". Looking at the world details you'll find a variable called turnSpeed and it's set to 0.12. There is no difference in doing this than physically setting the speed to a value. The variable is created for convenience; you can reference it throughout the program, and if you ever need or want to change the turn rate later you can do so by just changing it in one place.

To mimic this go to World Details, then the Properties tab and click "create new variable". Create a variable called "code" (since you are already calling it this in your click events) and set it to 0.12.

As for the Air Raid Siren.... to find sound attachments look in the Details Windows & the Properties tab. Scroll down until you see Sounds. It's attached to both the World & the Spaceship (but only being called by the spaceship).

Last edited by Jabberwocky; 06-06-2006 at 12:51 PM.
   
Reply With Quote
Old
Samo
Guest
 
Status:
Posts: n/a
Default 06-07-2006, 06:48 AM

haha! it works, thank you very much. now there's just one more problem, why is the infinite loop, well, not infinitely looping
   
Reply With Quote
why the infinite loop is not infinitely looping
Old
Jabberwocky
Guest
 
Status:
Posts: n/a
Default why the infinite loop is not infinitely looping - 06-07-2006, 04:58 PM

Short answer:

In your Spaceship's Take Control method remove the Loop from around the Do Together. Then inside the Do Together wrap Loops around each individual command.

(The camera.follow_space_craft method already has a loop inside it and the roket1mala.lock_on_spacecraft method has an embedded While loop. So no need to have loops on those.)

Long Answer:

The Flight Simulator example world has good explanation for this in the comments of the World's Begin Flying method.

"A Do together is not finished until slowest animation in it is finished. This can create awkward pauses. The fix is to wrap an infinite loop around a Do together around each group of simultaneous animations that have the same duration."

It seems this is what you are trying to do in your Take Control method by wrapping an infinite Loop around a Do Together. However, your Do Together doesn't just contain a "group of simultaneous animations"; you also call other methods, each of which have numerous commands with varying durations.

Other Stuff:

1) Arrow-key Click Events: Recreate all of the arrow-key click events. The world kept intermittently crashing on me until I did.

2) Air Raid Siren: The Air Raid Siren is attached to the Spacedock not the Spaceship like I said in a previous post.

(To figure this stuff out on your own, notice how things are called. Look in the Details window of an object. Each object has properties, methods, and functions. Whenever you use one of these in your code the object name precedes the attribute name, method name, or function name. For example in your World's My First Method routine the call to play the air raid siren references Spacedock.air_raid_siren So you know to look in the Spacedock object's properties to find the sound attachment.)

3) Sound Duration: Looking at the durations of the sounds you are using I noticed, a lot of the sounds you have attached are extremely short, only a 10th of a second. Even if played with a longer duration in the code I still don't hear anything on most of them. Look at the Fighter's start_up2 sound for example. (Note: Scroll to the right when looking at a sound tile to see it's duration. Also, click on the green arrows next to the sound tile to test/play the sound.)

4) Hyperdrive Use Counter: You have code in your hyperdrive method to limit it's use. Currently though, the user can activate the hyperdrive as much as they want. Each time the hyperdrive method is called the counter is being reset because you are using a local variable which is initialized to zero.

You need to create a World class variable to keep track of how many times the hyperdrive is used. Variables created in the World class are global. That way you'll be able to retain the value of the counter over time.

So, create a world class variable. Then replace your references to the hyperdrive method's local variable (X) with the new World class global variable. Delete the local variable when you are done since you no longer need it.

Last edited by Jabberwocky; 06-07-2006 at 09:21 PM.
   
Reply With Quote
Old
Samo
Guest
 
Status:
Posts: n/a
Default 06-08-2006, 08:19 PM

thank you, there's just one final problem

when the rocket gets within 0 meters of the spaceship, the missile along with the spaceship is supposed to go to 0% opacity

also, how do i import regular 2D images?
   
Reply With Quote
Boom Boom, out go the lights!
Old
Jabberwocky
Guest
 
Status:
Posts: n/a
Default Boom Boom, out go the lights! - 06-08-2006, 09:47 PM

How do i import 2D images?

File --> Make Billboard

Missile Strike

Yeah, your roket1mala.lock_on_space_craft method needs work. Write some pseudocode, get out pencil & paper and work out the logic of what you want to do in the simplest of terms, then go back to Alice and try to work it out.

For example, you say you want the spaceship and missile to go to zero opacity but you never set the ship's opacity. You do set the missile's opacity to zero if the missile gets within 0 meters of the ship, (it should kick out of the while loop and execute the set opacity command; remember though, the ship is still moving & the missile is coded with some funky herky-jerky random movement, so the missle actually touching the ship might never happen), but inside the while loop you contradict yourself and set the missile's opacity to 100% if the missle is less than 100 meters away. You need to rethink this method.

Good luck!

Last edited by Jabberwocky; 06-10-2006 at 03:12 PM.
   
Reply With Quote
Old
Samo
Guest
 
Status:
Posts: n/a
Default 06-09-2006, 06:59 AM

ok, well, i presented, but it didn't exactly go as planned

anyways, forgot who said they wanted it but, here ya go:
Attached Files
File Type: zip Space Colony Attack.zip (4.26 MB, 372 views)
   
Reply With Quote
Poof!
Old
Jabberwocky
Guest
 
Status:
Posts: n/a
Default Poof! - 06-10-2006, 03:33 PM

It's probably a moot point now, but if you set the While loop, in your roket1mala.lock_on_space_craft method, to 5 meters or greater instead of zero the ship & rocket will become invisible.
   
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 ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.