ファイル
nizika_desktop/main.hsp
T
2023-06-04 20:53:40 +09:00

83 行
1.6 KiB
Plaintext

#include "user32.as"
#packopt hide 1
#packopt name "nizika-desktop"
#const NIZIKA_WIDTH 300
#const NIZIKA_HEIGHT 300
#const NIZIKA_BASE 240
#const NIZIKA_LEFT 60
#const NIZIKA_RIGHT 250
; 半透明スクリーン作成
SCREEN_MAIN = BgScr2 (gInfo_dispX, gInfo_dispY, SCREEN_HIDE, 0, 0)
SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong (hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes hWnd, RGBCOLOUR_LIME, False, True
Color COLOUR_LIME
BoxF
SCREEN_NIZIKA = Buffer2 ()
PicLoad "assets/nizika.png"
GSel SCREEN_MAIN, 2
frame = 0
nizikaX = Double (-NIZIKA_LEFT)
nizikaY = Double (gInfo_dispY - NIZIKA_BASE)
direction = 1
moving = False
falling = True
Repeat
If GetKey2 (KEY_MOUSE_L) {
If moving {
nizikaX = LimitF (mouseX - offsetX, -NIZIKA_LEFT, gInfo_dispX - NIZIKA_RIGHT)
nizikaY = LimitF (mouseY - offsetY, Null, gInfo_dispY - NIZIKA_BASE)
}
Else {
moving = True
offsetX = Double (mouseX - nizikaX)
offsetY = Double (mouseY - nizikaY)
}
}
Else: If moving {
moving = False
falling = True
fallVel = 0.
}
Else: If falling {
nizikaY = LimitF (nizikaY + fallVel, Null, gInfo_dispY - NIZIKA_BASE)
fallVel += 9.8
If nizikaY >= gInfo_dispY - NIZIKA_BASE {
falling = False
}
}
ReDraw False
Color COLOUR_LIME
BoxF
Pos nizikaX, nizikaY
GCopy SCREEN_NIZIKA, IIf (direction < 0, NIZIKA_WIDTH, 0), NIZIKA_HEIGHT * (frame \ 24), NIZIKA_WIDTH, NIZIKA_HEIGHT
ReDraw True
nizikaX += direction * 4
If (nizikaX >= gInfo_dispX - NIZIKA_RIGHT) || (nizikaX < -NIZIKA_LEFT) {
direction = -direction
}
Await 33
frame++
Loop