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