Alice Community How to make a game work?

 How to make a game work?
 infowire Guest   Status: Posts: n/a How to make a game work? - 12-07-2009, 04: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
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 12-07-2009, 05: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 04:27 PM.
 infowire Guest   Status: Posts: n/a 12-07-2009, 03:46 PM how do you make a vehicle? i just have a football object
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 12-07-2009, 04:28 PM Vehicles are in the vehicles section of the objects gallery. Or did you mean 'variable?' (')>
 infowire Guest   Status: Posts: n/a 12-07-2009, 05: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.
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 12-07-2009, 06: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. (')>
 infowire Guest   Status: Posts: n/a 12-07-2009, 07: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
 Dameria Senior Member     Status: Offline Posts: 976 Join Date: Sep 2009 Location: United States 12-07-2009, 08: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 08:19 PM.
 infowire Guest   Status: Posts: n/a 12-07-2009, 08:32 PM k got that, i got the 3d text looping infinitely, now i need to stop it when space is pressed?
 Dameria Senior Member     Status: Offline Posts: 976 Join Date: Sep 2009 Location: United States 12-07-2009, 08: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).

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge