Alice Community  

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

Reply
 
Thread Tools Display Modes
How to make a game work?
Old
infowire
Guest
 
Status:
Posts: n/a
Default How to make a game work? - 12-07-2009, 03:58 AM

Hi, so i am making a game where a guy kicks a football through a goal post, my question is how can i make the football fly to different parts of the world like miss the goal post depending on when the user clicks a button, also how do i make a power meter for the kick power? I need the power meeter jump back and fourth and depending when the user clicks a button it determines the power and kicks at it and that determines the flight of the football....

I need some help to accomplish this.


Thank You
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-07-2009, 04:05 AM

You'd need a variable which determines how much power the kick has, and a loop which keeps making the direction of the ball and the power of the kick vary with time.

Go ahead and show me what YOU think the code would look like. I'll help you along from there.


(')>

Last edited by x2495iiii; 12-07-2009 at 03:27 PM.
   
Reply With Quote
Old
infowire
Guest
 
Status:
Posts: n/a
Default 12-07-2009, 02:46 PM

how do you make a vehicle? i just have a football object
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-07-2009, 03:28 PM

Vehicles are in the vehicles section of the objects gallery.

Or did you mean 'variable?'


(')>
   
Reply With Quote
Old
infowire
Guest
 
Status:
Posts: n/a
Default 12-07-2009, 04:59 PM

lol i dont know why i said vehice, i think i was reading a different post and replied to this one.


anyways, what would you suggest to do to make the football fly based on when the user presses a button.

I was thinking of making the arrows turn the kicker to get the angle and then a power meter so when the user presses a button depending on what power it is at it kicks the ball.

Not quite sure how to do that in Alice, all the help would be appreciated.

So maybe for the power of the kick i can make the guys foot bend back and forth somehow on a loop, but i' am not sure how that would generate me a number for the force of the kick.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-07-2009, 05:29 PM

It wouldn't. You'd need to make your own number generation which moves at the same time as the football player's leg and goes up until it hits max power, then starts decrementing until it hits zero, and repeats.


(')>
   
Reply With Quote
Old
infowire
Guest
 
Status:
Posts: n/a
Default 12-07-2009, 06:56 PM

how can i make the 3d text display the number that is being randomly generated, then i need it to stop the generation once the button is pressed
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-07-2009, 07:06 PM

You could have two variables, one being randomNumber, the other is buttonPressed. Then 3d Text as an object

Create a method called "Button" somewhere, then you could have an event saying when button is pressed, do "Button". In that method make buttonPressed == 0.

Then in another method you create, you can do If "buttonPressed == 0" do nothing / Else do 3d Text set text to ("randomNumber" as a String) (you get the "as a string" from the functions tab of World).

I kinda lost my train of thought here, but so far it sounds like that should work.

EDIT: Oh ya and you would have to make the if/else statement in a continuous loop, or in a while(true), or as a "While world is running" event in the event box.

Last edited by Dameria; 12-07-2009 at 07:19 PM.
   
Reply With Quote
Old
infowire
Guest
 
Status:
Posts: n/a
Default 12-07-2009, 07:32 PM

k got that, i got the 3d text looping infinitely, now i need to stop it when space is pressed?
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-07-2009, 07:33 PM

Did you do the Button method that I said? Where it changes variable, and in your method where you have the if/else you make sure if variable is 2, then do nothing.

You can do in event box When space button is pressed, do Button (the method).
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.