Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   How to make a game work? (http://www.alice.org/community/showthread.php?t=3543)

infowire 12-07-2009 03:58 AM

How to make a game work?
 
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 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.

infowire 12-07-2009 02:46 PM

how do you make a vehicle? i just have a football object

x2495iiii 12-07-2009 03:28 PM

Vehicles are in the vehicles section of the objects gallery.

Or did you mean 'variable?'

infowire 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.

x2495iiii 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.

infowire 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

Dameria 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.

infowire 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?

Dameria 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).


All times are GMT -5. The time now is 10:03 AM.

Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.