Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set variables as zero
- fMov = 0;
- aDrag = 0;
- gDrag = 0;
- totalF = 0;
- function moveStuff() {
- //Get values from text fields
- fMov = fmov.text;
- aDrag = adrag.text;
- gDrag = gdrag.text;
- // Calculate total force
- totalF = fMov - ( aDrag + gDrag );
- // Show total force
- totalf.text = totalF;
- if ( totalF > 0 )
- {
- // if total force is greater than zero, rotate rectangle
- rect._rotation += totalF;
- }
- }
- rect.onEnterFrame = moveStuff;
- /// Result table. Not part of code
- gDrag aDrag fMov total rotates
- 1 0 100 99 yes
- 1 10 10 -1 no
- 1 3 50 19 yes (very fast)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement