Advertisement
Guest User

Untitled

a guest
Feb 1st, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include "script/Tutorial/lib_sound.dnh"
  2.  
  3. let selectIndex = 0;
  4.  
  5. let obj = ObjPrim_Create(OBJ_SPRITE_2D);
  6.  
  7. @Initialize{
  8. SetAutoDeleteObject(true);
  9. TBackground;
  10. TMenu;
  11. }
  12.  
  13. @MainLoop{
  14. yield;
  15. }
  16.  
  17. @Finalize{
  18.  
  19. }
  20.  
  21. task TBackground{
  22. ObjPrim_SetTexture(obj, "script/Tutorial/images/screensave.png");
  23. ObjSprite2D_SetSourceRect(obj, 0, 0, 640, 480);
  24. ObjSprite2D_SetDestRect(obj, 0, 0, 640, 480);
  25. Obj_SetRenderPriorityI(obj, 10);
  26. }
  27.  
  28. task TMenu{
  29. if(GetCommonData("Continues", 0) < 0){
  30. selectIndex = 1;
  31. }
  32. let texts = ["Continue", "Return to Title", "Save Replay", "Retry Game"];
  33. let elementCount = length(texts);
  34. let X = -70;
  35. let Y = 220;
  36. ascent(i in 0..elementCount){
  37. TMenuItemText(i, X, Y, texts[i]);
  38. Y += 40;
  39. }
  40.  
  41. while(GetVirtualKeyState(VK_OK) != KEY_FREE || GetVirtualKeyState(VK_CANCEL) != KEY_FREE){yield;}
  42.  
  43. let frameKeyHold = 0;
  44.  
  45. loop{
  46.  
  47. if(GetVirtualKeyState(VK_OK) == KEY_PUSH){
  48. ok0(40);
  49. SetScriptResult(selectIndex);
  50. CloseScript(GetOwnScriptID());
  51. return;
  52.  
  53.  
  54. yield;
  55. }
  56. Obj_Delete(obj);
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement