伊地知ニジカのデスクトップ・マスコットです.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.hsp 1.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include "user32.as"
  2. #pack "start.ax" ; 暗号化防止
  3. #packopt hide 1
  4. #packopt name "nizika-desktop"
  5. #const NIZIKA_WIDTH 300
  6. #const NIZIKA_HEIGHT 300
  7. #const NIZIKA_BASE 240
  8. #const NIZIKA_LEFT 60
  9. #const NIZIKA_RIGHT 250
  10. ; 半透明スクリーン作成
  11. SCREEN_MAIN = BgScr2 (gInfo_dispX, gInfo_dispY, SCREEN_HIDE, 0, 0)
  12. SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong (hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
  13. SetLayeredWindowAttributes hWnd, RGBCOLOUR_LIME, False, True
  14. Color COLOUR_LIME
  15. BoxF
  16. SCREEN_NIZIKA = Buffer2 ()
  17. PicLoad "assets/nizika.png"
  18. GSel SCREEN_MAIN, 2
  19. frame = 0
  20. nizikaX = Double (-NIZIKA_LEFT)
  21. nizikaY = Double (gInfo_dispY - NIZIKA_BASE)
  22. direction = 1
  23. moving = False
  24. falling = True
  25. Repeat
  26. If GetKey2 (KEY_MOUSE_L) {
  27. If moving {
  28. nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT)
  29. nizikaY = LimitF (mouseY - offsetY, Null, gInfo_dispY - NIZIKA_BASE)
  30. }
  31. Else {
  32. moving = True
  33. offsetX = Double (mouseX - nizikaX)
  34. offsetY = Double (mouseY - nizikaY)
  35. }
  36. }
  37. Else: If moving {
  38. moving = False
  39. falling = True
  40. fallVel = 0.
  41. }
  42. Else: If falling {
  43. nizikaY = LimitF (nizikaY + fallVel, Null, gInfo_dispY - NIZIKA_BASE)
  44. fallVel += 9.8
  45. If nizikaY >= gInfo_dispY - NIZIKA_BASE {
  46. falling = False
  47. }
  48. }
  49. ReDraw False
  50. Color COLOUR_LIME
  51. BoxF
  52. Pos nizikaX, nizikaY
  53. GCopy SCREEN_NIZIKA, IIf (direction < 0, NIZIKA_WIDTH, 0), NIZIKA_HEIGHT * (frame \ 24), NIZIKA_WIDTH, NIZIKA_HEIGHT
  54. ReDraw True
  55. nizikaX += direction * 4
  56. If (nizikaX >= gInfo_dispX - NIZIKA_RIGHT) || (nizikaX < -NIZIKA_LEFT) {
  57. direction = -direction
  58. }
  59. Await 33
  60. frame++
  61. Loop