Mini-Monster-Mixer
#11
Experiment with these monsters and Mastergy's 3d points program

The 2 attached images are needed:


Code: (Select All)
'Space Monster Ritual - james2464 Nov 18 2022

'Modified 3d points program by Mastergy

'Includes Art and/or Code from Mini-Monster-Mixer v0.2 created by James D. Jarvis

Screen _NewImage(800, 600, 32)

spritesheet = _LoadImage("monsters64.png", 32)
_Delay .5
Dim sprites&(40)
For j = 0 To 39
    sprites&(j) = _NewImage(64, 64, 32)
Next j
ct = 0
Dim c As Long
c = _RGB(0, 0, 0)
For k = 1 To 5
    For j = 1 To 8
        ct = ct + 1
        _PutImage (1, 64)-(64, 1), spritesheet, sprites&(ct), (j * 64 - 63, k * 64 - 63)-(j * 64, k * 64)

        'Cls
        '_PutImage (1, 1), sprites&(ct)
        'Sleep
    Next j
Next k

For j = 0 To 39
    _ClearColor c, sprites&(j)
Next j



'create texture
shadows = 100
Dim texture(shadows - 1)
text_size = 64
'For at = 0 To shadows - 1
'temp = _NewImage(text_size, text_size, 32)
'_Dest temp
'grey = 255 - 252 / (shadows - 1) * at
'Color _RGB(grey, grey, grey)
'Circle (text_size / 2, text_size / 2), text_size * .45
'Paint (text_size / 2, text_size / 2)
'texture(at) = _CopyImage(temp, 33)
'_FreeImage temp
'Next at
For j = 0 To 39
    texture(j) = _CopyImage(sprites&(j), 33)
Next j


texture(0) = _LoadImage("qb64pe-64.png", 33)


'create 3D points in a spherical shape
points_c = 800
space_size = 1000
Dim points(points_c - 1, 2)
For ap = 0 To points_c - 1
    Do
        points(ap, 0) = space_size * Rnd
        points(ap, 1) = space_size * Rnd
        points(ap, 2) = space_size * Rnd
    Loop While Sqr((points(ap, 0) - space_size / 2) ^ 2 + (points(ap, 1) - space_size / 2) ^ 2 + (points(ap, 2) - space_size / 2) ^ 2) > space_size / 2
Next ap

'create spectator
Dim Shared sp(6)
'sp(0) = space_size / 2 'X to center space
'sp(1) = space_size / 2 'Y to center space
'sp(2) = space_size / 2 'Z to center space
sp(0) = 350
sp(1) = 700
sp(2) = 470
sp(3) = -.644 'looking in the direction of the observer XZ
sp(4) = 0 'looking in the direction of the observer YZ
sp(5) = 1 'multiplier X-Y see
sp(6) = 1 'multiplier Z see

'create screen
scr = _NewImage(1000, 1000 / _DesktopWidth * _DesktopHeight, 32)
Screen scr
_MouseHide
_FullScreen
_Dest scr
_DisplayOrder _Hardware , _Software
'Print "turn with the mouse, move with the mouse buttons, adjust the light with the mouse wheel!"
brightness = 90
flag = 0
Do
    _Limit 40

    points(0, 0) = 500: points(0, 1) = 500: points(0, 2) = 470
    points(1, 0) = 500: points(1, 1) = 500: points(1, 2) = 500
    points(2, 0) = 500: points(2, 1) = 500: points(2, 2) = 530



    '====================================================================
    If flag = 0 Then
        ct = 0
        For ap = 0 To points_c - 1

            If ap > 2 Then

                If (points(ap, 0)) > 550 Then
                    ct = ct + 1
                    points(ap, 0) = points(ap, 0) + Rnd * 2 - 1.5
                Else
                    If points(ap, 0) < 450 Then
                        ct = ct + 1
                        points(ap, 0) = points(ap, 0) + Rnd * 2 - .5
                    End If
                End If

                If (points(ap, 1)) > 550 Then
                    ct = ct + 1
                    points(ap, 1) = points(ap, 1) + Rnd * 2 - 1.5
                Else
                    If points(ap, 1) < 450 Then
                        ct = ct + 1
                        points(ap, 1) = points(ap, 1) + Rnd * 2 - .5
                    End If
                End If

                If (points(ap, 2)) > 550 Then
                    ct = ct + 1
                    points(ap, 2) = points(ap, 2) + Rnd * 2 - 1.5
                Else
                    If points(ap, 2) < 450 Then
                        ct = ct + 1
                        points(ap, 2) = points(ap, 2) + Rnd * 2 - .5
                    End If
                End If
            End If
        Next ap

        points(0, 0) = 500: points(0, 1) = 500: points(0, 2) = 470
        points(1, 0) = 500: points(1, 1) = 500: points(1, 2) = 500
        points(2, 0) = 500: points(2, 1) = 500: points(2, 2) = 530

        If ct = 0 Then
            flag = 1
        End If
    End If

    '====================================================================

    If flag = 1 Then
        ct2 = 0
        For ap = 0 To points_c - 1

            nrad = ap / points_c * (_Pi * 2.1)
            nx = Cos(nrad) * 350 + 500
            ny = Sin(nrad) * 350 + 500
            If ap > 2 Then
                If (points(ap, 0)) > nx + .1 Then
                    ct2 = ct2 + 1
                    points(ap, 0) = points(ap, 0) + Rnd * 2 - 1.5
                Else
                    If points(ap, 0) < nx - .1 Then
                        ct2 = ct2 + 1
                        points(ap, 0) = points(ap, 0) + Rnd * 2 - .5
                    End If
                End If

                If (points(ap, 1)) > ny + .1 Then
                    ct2 = ct2 + 1
                    points(ap, 1) = points(ap, 1) + Rnd * 2 - 1.5
                Else
                    If points(ap, 1) < ny - .1 Then
                        ct2 = ct2 + 1
                        points(ap, 1) = points(ap, 1) + Rnd * 2 - .5
                    End If
                End If

                If (points(ap, 2)) > 500.1 Then
                    ct2 = ct2 + 1
                    points(ap, 2) = points(ap, 2) + Rnd * 2 - 1.5
                Else
                    If points(ap, 2) < 499.9 Then
                        ct2 = ct2 + 1
                        points(ap, 2) = points(ap, 2) + Rnd * 2 - .5
                    End If
                End If
            End If
        Next ap

        points(0, 0) = 500: points(0, 1) = 500: points(0, 2) = 470
        points(1, 0) = 500: points(1, 1) = 500: points(1, 2) = 500
        points(2, 0) = 500: points(2, 1) = 500: points(2, 2) = 530
        If ct2 = 0 Then
            flag = 2
            sp(0) = 500
            sp(1) = 1500
            sp(2) = 470
            sp(4) = 0
            sp(3) = 0
            _Delay 1
        End If
    End If
    '====================================================================

    If flag = 2 Then

        'sp(0) = 500
        'sp(1) = 510
        'Sleep


        dv = 50
        d1 = Abs((sp(0) - 500) / dv)
        d2 = Abs((sp(1) - 510) / dv)


        If sp(0) < 500 Then
            sp(0) = sp(0) + d1
        Else
            sp(0) = sp(0) - d1
        End If

        If sp(1) > 510 Then
            sp(1) = sp(1) - d2
        Else
            sp(1) = sp(1) + d2
        End If

        dt = 0
        If Abs(d1) < .002 Then dt = dt + 1
        If Abs(d2) < .002 Then dt = dt + 1

        If dt = 2 Then
            flag = 3
            sp(2) = 470
            sp(4) = 0
            sp(3) = 0
        End If
    End If



    'draw points
    For ap = 0 To points_c - 1
        x = points(ap, 0)
        y = points(ap, 1)
        z = points(ap, 2)
        rotate_to_maptriangle x, y, z 'position of points from the point of view of the observer

        'actual_shadow = Int(Abs(z) * (.3 + brightness)) 'distance proportional texture
        'actual_shadow = brightness

        actual_shadow = ap / 22


        If actual_shadow > shadows - 1 Then actual_shadow = 10
        If actual_shadow <= 2 Then actual_shadow = 3
        If ap < 3 Then actual_shadow = 0

        ps = 2 'point size on the screen
        _MapTriangle (0, 0)-(text_size - 1, 0)-(0, text_size - 1), texture(actual_shadow) To(x - ps, y - ps, z)-(x + ps, y - ps, z)-(x - ps, y + ps, z)
        _MapTriangle (text_size - 1, text_size - 1)-(text_size - 1, 0)-(0, text_size - 1), texture(actual_shadow) To(x + ps, y + ps, z)-(x + ps, y - ps, z)-(x - ps, y + ps, z)

    Next ap



    _Display


    'mouse input axis movement and mousewheel
    mousex = mousex * .6
    mousey = mousey * .6
    mw = 0
    While _MouseInput: mousex = mousex + _MouseMovementX: mousey = mousey + _MouseMovementY: mw = mw + _MouseWheel: Wend 'movement data read

    'control spectator
    mouse_sens = .001 'mouse rotating sensitive
    sp(3) = sp(3) - mousex * mouse_sens
    sp(4) = sp(4) + mousey * mouse_sens
    If Abs(sp(4)) > _Pi / 2 Then sp(4) = _Pi / 2 * Sgn(sp(4))
    vec_x = (Sin(sp(3)) * (Cos(sp(4) + _Pi)))
    vec_y = (Cos(sp(3)) * (Cos(sp(4) + _Pi)))
    vec_z = -Sin(sp(4) + _Pi)
    speed = 2 'moving speed
    moving = Abs(_MouseButton(1) Or _KeyDown(Asc("w"))) * speed - Abs(_MouseButton(2) Or _KeyDown(Asc("s"))) * speed
    sp(0) = sp(0) + vec_x * moving
    sp(1) = sp(1) + vec_y * moving
    sp(2) = sp(2) + vec_z * moving

    'control brightness
    brightness = brightness + mw / 2


Loop Until _KeyDown(27)

Sub rotate_to_maptriangle (x, y, z)
    x2 = x - sp(0)
    y2 = y - sp(1)
    z2 = z - sp(2)
    rotate_2d x2, y2, sp(3)
    rotate_2d y2, z2, sp(4) + _Pi / 2
    x = x2 * sp(5)
    y = y2 * sp(5)
    z = z2 * sp(6)
End Sub

Sub rotate_2d (x, y, ang)
    x1 = x * Cos(ang) - y * Sin(ang)
    y1 = x * Sin(ang) + y * Cos(ang)
    x = x1: y = y1
End Sub


Attached Files Image(s)
       
Reply


Messages In This Thread
Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 03:10 PM
RE: Mini-Monster-Mixer - by bplus - 11-18-2022, 03:29 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 03:35 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 03:50 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 04:44 PM
RE: Mini-Monster-Mixer - by mnrvovrfc - 11-18-2022, 04:48 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 04:48 PM
RE: Mini-Monster-Mixer - by james2464 - 11-18-2022, 06:55 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 07:49 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 07:51 PM
RE: Mini-Monster-Mixer - by james2464 - 11-18-2022, 10:06 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-18-2022, 10:19 PM
RE: Mini-Monster-Mixer - by Dav - 11-19-2022, 12:44 AM
RE: Mini-Monster-Mixer - by bplus - 11-19-2022, 01:30 AM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-19-2022, 05:11 PM
RE: Mini-Monster-Mixer - by James D Jarvis - 11-20-2022, 03:57 AM
RE: Mini-Monster-Mixer - by grymmjack - 07-15-2023, 12:50 AM
RE: Mini-Monster-Mixer - by Dav - 07-15-2023, 01:13 AM
RE: Mini-Monster-Mixer - by James D Jarvis - 07-20-2023, 02:37 AM
RE: Mini-Monster-Mixer - by James D Jarvis - 07-20-2023, 02:43 AM



Users browsing this thread: 1 Guest(s)