Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Set variables as zero
  2. fMov = 0;
  3. aDrag = 0;
  4. gDrag = 0;
  5. totalF = 0;
  6.  
  7. function moveStuff() {
  8.     //Get values from text fields
  9. fMov = fmov.text;
  10. aDrag = adrag.text;
  11. gDrag = gdrag.text;
  12.        
  13. // Calculate total force
  14. totalF = fMov - ( aDrag + gDrag );
  15. // Show total force
  16. totalf.text = totalF;
  17. if ( totalF > 0 )
  18. {
  19. // if total force is greater than zero, rotate rectangle
  20. rect._rotation += totalF;
  21. }
  22. }
  23. rect.onEnterFrame = moveStuff;
  24.  
  25.  
  26.  
  27. /// Result table. Not part of code
  28. gDrag     aDrag     fMov     total   rotates
  29. 1          0        100       99     yes
  30. 1         10        10       -1      no
  31. 1         3         50        19     yes (very fast)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement