Alice Community  

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

Reply
 
Thread Tools Display Modes
Grouping objects
Old
materia
Guest
 
Status:
Posts: n/a
Default Grouping objects - 04-19-2006, 06:12 AM

hi.....

I was wondering how to group items, i have made a number of cones that the player has to avoid whilst driving, they are numbered 1 - 4.
What i wish to know is how to make one rule for all the cones instead of having to specify what each cone is suposed to do when the car runs over it.

All the cones do the same thing but as i have 4 cones then i have had to put the same code 4 times, is there a more efficient way?

Cheers.
   
Reply With Quote
Grouping Objects
Old
lanceA
Guest
 
Status:
Posts: n/a
Default Grouping Objects - 04-19-2006, 06:53 AM

Hi -
It sounds as though you want to write a world-level method for your cones. If each cone does the same thing when the user drives over it then a single method is definitely in order.

You can do this by selecting the World in your Object Tree and then clicking on the create new method button in the Details view area. You could pass each cone object as a parameter to this new world-level method if you wanted something different to happen when one of the cones was hit.

If you have the manual they give several examples of how to do this beginning in chapter 4. It is rather easy to do.

Good luck and I hope this helps
   
Reply With Quote
Old
materia
Guest
 
Status:
Posts: n/a
Default 04-21-2006, 12:55 PM

Hi thanks for replying to me so quick.....

I dont have the munual unfortunatly

I kinda understand what your saying and i tried what u said but im still confused when it comes to these things and not sure what else i have to do.

What do i set the parameter as, then how do i tell alice that the parameter represents all of the cones i put down?

Gonna keep playing around with it see if i can get anywhere.

Thanks for any help you can give me
   
Reply With Quote
Grouping objects
Old
lanceA
Guest
 
Status:
Posts: n/a
Default Grouping objects - 04-21-2006, 03:42 PM

It would probably be simpler and quicker if I just sent you the code to do it. If you send me the world file (.a2w) I will return it with a method attached that you then can edit, modify, etc. You can also view/play with it to increase your knowledge in using Alice.

My email is lanceallen.allen@gmail.com.

Good luck
   
Reply With Quote
Grouping Objects
Old
lanceA
Guest
 
Status:
Posts: n/a
Default Grouping Objects - 04-22-2006, 10:57 AM

I received your driving project. I added a new method, ConeDown, which receives an object as a parameter. I placed numerous comments in the code I am returning to you in hopes it helps you understand how it now funtions. Note that I named the returned file project1.a2w so that you do not overwrite your original work when you download it.

Good luck
   
Reply With Quote
Grouping objects
Old
RobRohr
Guest
 
Status:
Posts: n/a
Default Grouping objects - 04-22-2006, 10:39 PM

That's a great idea for applying the same methods to many objects of the same type.

My problem is, I wish to aggregate a several objects into one, with its own internal methods and properties, specifically I want to take basic objects from the gallery (square, cone, fences) and group them into an object called a cell, that I can import as one item.

Basically, I want to turn classes into sub-parts of a new object that can be inserted repeatedly. Is the only place to create subparts in one of the threeD editors?
   
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.