Advertisement
Guest User

Untitled

a guest
Aug 27th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. task TTestZoom(xZoomTarget,yZoomTarget){
  2. //The beginning camera zoom
  3. let xZoom = Get2DCameraRatioX();
  4. let yZoom = Get2DCameraRatioY();
  5. //The difference in current zoom and desired zoom
  6. let xZoomDiff = xZoomTarget - xZoom;
  7. let yZoomDiff = yZoomTarget - yZoom;
  8. //The current frame boundary
  9. let stgFrameLeft = GetStgFrameLeft();
  10. let stgFrameTop = GetStgFrameTop();
  11. let stgFrameWidth = GetStgFrameWidth();
  12. let stgFrameHeight = GetStgFrameHeight();
  13. let stgFrameRight = stgFrameLeft + stgFrameWidth;
  14. let stgFrameBottom = stgFrameTop + stgFrameHeight;
  15. //The current 2D camera x & y positions
  16. let cameraX = Get2DCameraX();
  17. let cameraY = Get2DCameraY();
  18. // Width and height of frame to be added/removed
  19. let stgFrameWidthDiff = stgFrameWidth/xZoomTarget - stgFrameWidth;
  20. let stgFrameHeightDiff = stgFrameHeight/yZoomTarget - stgFrameHeight;
  21.  
  22. let rate = 120;
  23. WriteLog(rtoa(stgFrameLeft)~", "~rtoa(stgFrameTop)~", "~rtoa(stgFrameWidth)~", "~rtoa(stgFrameHeight));
  24. loop(rate){
  25. //Increments width and height by up the desired width and height
  26. stgFrameRight += stgFrameWidthDiff/rate;
  27. stgFrameBottom += stgFrameHeightDiff/rate;
  28.  
  29. xZoom += xZoomDiff/rate;
  30. yZoom += yZoomDiff/rate;
  31.  
  32. SetStgFrame(stgFrameLeft,stgFrameTop,stgFrameRight - 70,stgFrameBottom -70,GetStgFrameRenderPriorityMinI(),GetStgFrameRenderPriorityMaxI()); //STG Frame Workaround
  33. Set2DCameraRatioX(xZoom);
  34. Set2DCameraRatioY(yZoom);
  35. Set2DCameraFocusX(GetStgFrameWidth/2/xZoom);
  36. Set2DCameraFocusY(GetStgFrameHeight/2/yZoom);
  37. yield;
  38. }
  39. WriteLog(rtoa(stgFrameLeft)~", "~rtoa(stgFrameTop)~", "~rtoa(stgFrameWidth)~", "~rtoa(stgFrameHeight));
  40. WriteLog(rtoa(xZoom)~", "~rtoa(yZoom));
  41. SetPlayerClip(12,12,GetStgFrameWidth-12 + 60,GetStgFrameHeight-12 + 60); //Player Movement Fix
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement