Help us understand the problem. What is going on with this article?

FUZE BASICを触ってみる3(ゲームの入り口)

今日やること

FUZE公式で配布されている、Worksheets(https://www.fuze.co.uk/worksheets-tutorials.html)
Coding Projects Book 1 - The Basics を斜め読みしてできるところまで進めてみます。

今回はProject: 5bのつづきから。
とりあえず目がきちんとうごくところまではもっていきたい。
お酒飲んだし、今日の進捗はいいはずー🤑
…と思ったらさっそくお腹痛くなってきた。最近酒飲むとお腹壊すようになったような😰

アンカー

前の記事)FUZE BASICを触ってみる2(ゲームの入り口)

Project: 5b "Bear With Me"

きちんと実装してみた…はず。
でも片目しか動かない…両目を動かすソースでえ実行するとフリーズする感じになります。何故だ?
ピカピカしているのは、撮影でそうなったわけではなくプログラムの問題です。
とりあえず今日はここまでとします!

output3.gif

CLS

center_x = GWIDTH / 2
center_y = GHEIGHT / 2
radius = GHEIGHT / 2 / 2

DIM ear_center(2, 2)
ear_center(0, 0) = center_x - radius
ear_center(0, 1) = center_y + radius
ear_center(1, 0) = center_x + radius
ear_center(1, 1) = center_y + radius

eye_radius = radius / 4

DIM eye_center(2, 2)
eye_center(0, 0) = center_x - eye_radius 
eye_center(0, 1) = center_y + eye_radius
eye_center(1, 0) = center_x + eye_radius
eye_center(1, 1) = center_y + eye_radius

LOOP
    CLS2
    PROC DrawBar
    PROC DrawEyeBase
    PROC DrawEye
    WAIT (0.05)
    UPDATE
REPEAT

END

DEF FN GetRadian(x1, y1, x2, y2)
    radian = ATAN(( y2 - y1 ) / ( x2 - x1 ) )
=radian

DEF PROC DrawBar
    COLOR = PINK
    CIRCLE ( center_x, center_y, radius, 1)
    CIRCLE ( ear_center(0, 0), ear_center(0, 1), radius / 2, 1)
    CIRCLE ( ear_center(1, 0), ear_center(1, 1), radius / 2, 1)
ENDPROC

DEF PROC DrawEyeBase
    COLOR = WHITE
    CIRCLE ( eye_center(0, 0), eye_center(0, 1) , eye_radius, 1)
    CIRCLE ( eye_center(1, 0), eye_center(1, 1),  eye_radius, 1)
ENDPROC

DEF PROC DrawEye

    mouse_x = MOUSEX
    mouse_y = MOUSEY

    radian1 = FN GetRadian(mouse_x, mouse_y, eye_center(0, 0), eye_center(0, 1))
    radian2 = FN GetRadian(mouse_x, mouse_y, eye_center(1, 0), eye_center(1, 1))

    COLOR = RED
    PRINT radian1
    PRINT radian2

    direction1 = -1
    direction2 = -1

    IF mouse_x > eye_center(0, 0) THEN
        direction1 = 1
    ENDIF

    IF mouse_x > eye_center(1, 0) THEN
        direction2 = 1
    ENDIF

    in_circle1 = FN InCircle(mouse_x, mouse_y, eye_center(0, 0), eye_center(0, 1), eye_radius)
    in_circle2 = FN InCircle(mouse_x, mouse_y, eye_center(1, 0), eye_center(1, 1), eye_radius)

    COLOR = YELLOW
    IF in_circle1 THEN
        CIRCLE ( mouse_x, mouse_y, radius / 10, 1)
    ELSE
        CIRCLE ( eye_center(0, 0) + ( COS(radian1) * eye_radius * direction1) ,  eye_center(0, 1) + ( SIN(radian1) * eye_radius * direction1), radius / 10, 1)
    ENDIF   
//  IF in_circle2 THEN
//      CIRCLE ( mouse_x, mouse_y, radius / 10, 1)
//  ELSE
//      CIRCLE ( eye_center(1, 0) + ( COS(radian2) * eye_radius * direction2) ,  eye_center(1, 1) + ( SIN(radian2) * eye_radius * direction2), radius / 10, 1)
//  END
ENDPROC

DEF FN InCircle(x1, y1, x2, y2, radius)
    result = FALSE
    IF SQRT(ABS(x2  - x1)) + SQRT(ABS(y2 - y1)) < SQRT(radius) THEN
        result = TRUE
    ENDIF
= result

所感

  • Coding Projects Book 1 - The Basics がなかなか終わらない。。。
  • 両目動かないよ、問題は環境による可能性が高い。FuzeBasicが使えるメモリ量とかあるんだろうな。Switch本体では起こらないと思うので一旦諦めるか?
  • いやいや、 CIRCLE描写でフリーズすることから、今の一枚のスクリーン全体を強引に書き換えている処理で、使えるVRAM?的な何かを使い切ったのかもしれない。ゲームにつながるし、明日調べてみよう。
  • お酒は偉大🍺うまく動かなくてもイライラしなくてなんだかトラブルも楽しい!!
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away