octachoron.nut 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*********************
  2. * *
  3. * Created by Hume *
  4. * *
  5. *********************/
  6. println("[DEBUG] levels/hume_rainbow_cave/octachoron.nut loaded");
  7. println("[INFO] Created by Hume");
  8. this.kod <- 0
  9. this.pokusy <- 0
  10. rand()
  11. this.a <- rand();
  12. this.b <- rand();
  13. this.randh <- rand();
  14. this.a <- this.a %100
  15. this.b <- this.b %100
  16. this.randh <- this.randh%2
  17. if(this.randh==1){
  18. this.operator <- " + "
  19. this.c <- this.a+this.b
  20. }else{
  21. this.operator <- " - "
  22. this.c <- this.a-this.b
  23. if(this.c<0){
  24. this.rand <- this.a
  25. this.a <- this.b
  26. this.b <- this.rand
  27. this.c <- this.a-this.b
  28. }
  29. }
  30. Text.set_anchor_point(ANCHOR_TOP_LEFT);
  31. Text.set_pos(30,120);
  32. Text.set_text(this.a+this.operator+this.b+" = ?")
  33. Text.fade_in(0.2);
  34. function zvorej(){
  35. Text.set_text(_("WRONG!"))
  36. this.rand <- this.a%8
  37. if(this.rand==0){
  38. door1.goto_node(1)
  39. }
  40. if(this.rand==1){
  41. door2.goto_node(1)
  42. }
  43. if(this.rand==2){
  44. door3.goto_node(1)
  45. }
  46. if(this.rand==3){
  47. door4.goto_node(1)
  48. }
  49. if(this.rand==4){
  50. door5.goto_node(1)
  51. }
  52. if(this.rand==5){
  53. door6.goto_node(1)
  54. }
  55. if(this.rand==6){
  56. door7.goto_node(1)
  57. }
  58. if(this.rand==7){
  59. door8.goto_node(1)
  60. }
  61. rand()
  62. }
  63. function pridej(cislo){
  64. if(this.pokusy<3){
  65. this.kod <- this.kod*10+cislo
  66. this.pokusy <- this.pokusy+1
  67. Text.set_text(this.a+this.operator+this.b+" = "+this.kod)
  68. if(this.kod==this.c){
  69. Text.set_text(_("GOOD!"))
  70. this.pokusy <- 3
  71. door1.goto_node(1)
  72. door2.goto_node(1)
  73. door3.goto_node(1)
  74. door4.goto_node(1)
  75. door5.goto_node(1)
  76. door6.goto_node(1)
  77. door7.goto_node(1)
  78. door8.goto_node(1)
  79. }else{
  80. if(this.pokusy==3){
  81. zvorej()
  82. }
  83. }
  84. }
  85. }