Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A game of pool...
#9
(02-22-2024, 07:20 PM)johnno56 Wrote: "more advanced"...

more advanced...perhaps a 3D-Pool  Big Grin

I just realized that making a 3D-Pool need a lot of different angles of 3D sprite sheet balls 
... and when I tried to animate a 3D ball rotated on its axis ... it exploded  Big Grin Big Grin Big Grin  [ Just my fantasy ]

Code:
'Source :
'3D Ball Sprite Sheet https://emunix.emich.edu/~evett/GameProgramming/BookCode/chapter11.new/multithread/sphere.bmp
'Explosion Sprite Sheet http://www.nordenfelt-thegame.com/blog/wp-content/uploads/2011/11/explosion_opaque.png

'----------------
' INITIALIZATION
'----------------
#win32
set window "Ball",200,200,false
set redraw off

cGreen = [0,128,0]
cWhite = [255,255,255]

'Sprite class definition
Sprite =
[
    '---- Properties ----
    img :loadimage("img/ball.png",8,4),
    x   :width(primary)/2-30,
    y   :height(primary)/2-30,
    sf  :0 'speed factor of rotation
]

Ball            = copy(Sprite)
Explosion       = copy(Sprite)
  Explosion.img = loadimage("img/explosion.png",5,5)
  Explosion.x   = Sprite.x-60
  Explosion.y   = Sprite.y-60

'----------------
'  MAIN PROGRAM
'----------------
do
    set color cGreen;cls;set color cWhite

    'ball rotates on its axis
    'the state of rotation : fast, slow then stop.
    for i = 0 to 31
        'set color cWhite
        draw image Ball.img,Ball.x,Ball.y,i 
        redraw
         
        Ball.speed = 200 - Ball.sf
        set caret 10,10;wln "Speed : "+Ball.speed
        fwait Ball.speed
    next
   
    'explosion visual effect
    Ball.sf = Ball.sf + 5
    if Ball.speed = 5 then
        for i = 0 to 24
            draw image Explosion.img,Explosion.x,Explosion.y,i
            fwait 10
            redraw
        next
        end
    endif
loop


Attached Files
.zip   3D Ball.zip (Size: 136.62 KB / Downloads: 5)
Reply


Messages In This Thread
A game of pool... - by kevin - 02-22-2024, 02:16 PM
RE: A game of pool... - by Marcus - 02-22-2024, 02:20 PM
RE: A game of pool... - by 1micha.elok - 02-22-2024, 02:59 PM
RE: A game of pool... - by Marcus - 02-22-2024, 03:31 PM
RE: A game of pool... - by kevin - 02-22-2024, 03:52 PM
RE: A game of pool... - by johnno56 - 02-22-2024, 07:20 PM
RE: A game of pool... - by 1micha.elok - 02-26-2024, 01:31 PM
RE: A game of pool... - by Marcus - 02-26-2024, 08:27 PM
RE: A game of pool... - by 1micha.elok - 02-27-2024, 03:40 AM
RE: A game of pool... - by 1micha.elok - 02-25-2024, 07:09 AM
RE: A game of pool... - by kevin - 02-25-2024, 02:04 PM
RE: A game of pool... - by johnno56 - 02-26-2024, 06:00 PM
RE: A game of pool... - by aliensoldier - 02-29-2024, 05:01 PM
RE: A game of pool... - by kevin - 02-29-2024, 05:21 PM
RE: A game of pool... - by aliensoldier - 02-29-2024, 08:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)