by Fuzzy » Tue May 09, 2006 10:15 pm
Nono. Never apologise for a question!
You are catching on fast! Yes, * means multiply, and it causes the ball to slow down because that formula is applied each time the ball is drawn, probably 30 times per second.
So when you hit the ball, its going 10, then next draw, its going 9(it rounds down from 9.5), the following draw it hits a speed of 8(8.55 really), followed by 7, 6, 5..... until it stops.
It makes me happy to see that you want to understand. So many just want help(as in "do this for me"). Ask any questions you want.
Power bars are a little tricky at first, so I'll show you how to display the power as a number. You wil be able to influence it with the up/down arrow keys too.
make an actor. Call it Display.
dont assign a animation.
Over on the right side of the actor control menu, find 'text' and press it. type 0000 in the grey box. Thats four zeros, no letter O.
Click new font and true type. Now click on the box beside file and find ariel.ttf in the list. It should be close to the start. If you dont have it, pick a different one. It doesnt matter.
Change size 32 to 64. You want nice big letters. Just leave the rest alone, and click ok.
Hit ok again, and you should see your four large white zeros. Move them up to the corner of the view(white border area). Your actor may be hidden behind the edit menu, just move it if so.
now, click add event then click key down.
press the up arrow key, and add action.
go to script editor, and click that. in the script editor, type
textNumber = textNumber + 1;
make sure you use the capital N, thats important.
hit add, and select immediate action.
it takes you back to the keypress event. hit the clear button, and then press down arrow. click add action, and then script editor. in this script, you do the same, except use - instead of +
textNumber = textNumber + 1;
Hit add, immediate action, then close.
press game mode and test. try using up and down arrow keys. the numbers should change.
now we need to add that speed to the ball. Its pretty easy.
In the actor edit menu, at the top is name: and in a box, it says Display. click that and find your ball.
click edit event, and select the key press (space), and then edit action. that should take you to the script editor and show the script that make the ball start moving.
Change it to say:
directional_velocity = Display.textNumber;
and now hit add, immediate.
test it out....
Let me know when you have that working, and then I have a way for you to check what you have learned.
Mortal Enemy of IF....THEN(and Inspector Gadget)
Still ThreeFingerPete to tekdino