Here's some interesting code to play with. Tinker as you please.
If you have any modifications or improvements to how it works.
POST IT!! for others to see :)
Enjoy
; PROJECT : mathrot
; AUTHOR : NA
; CREATED : 12/16/2011
; EDITED : 12/16/2011
; ---------------------------------------------------------------------
openscreen 1024, 768, 32, 1
fimage=loadnewfximage("ball.bmp")
imagemaskcolour fimage, rgb(255, 255, 255)
NumberOfObjects=32
;circle test
angle=-90
spd_rotate=1
radiusx=300
radiusy=300
yrotdir=-2
xrotdir=2
dim balloffset(numberofobjects)
main:
mx=mousex()
my=mousey()
for lp=1 to NumberOfObjects
ThisAngle=Angle+(360.0/NumberOfObjects)*lp
if thisangle=>360
balloffset(lp)=balloffset(lp)-5
endif
if spacekey()
balloffset(lp)=0
endif
ink rgb(0, 0, Angle)
; Calc the position of the oribiting object
OrbitX=mx+(Cos(ThisAngle)*radiusx+dx/2)
OrbitY=my+(Sin(ThisAngle)*radiusy+dy/2)
dx=balloffset(lp)
dy=balloffset(lp)
; display the moving object
;circle OrbitX,OrbitY,10,1
orbitx=orbitx-dx/2
orbity=orbity-dy/3
drawimage fimage, orbitx, orbity, 1
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
drawimage fimage, orbitx, orbity, 1
next
radiusx=radiusx-xrotdir
radiusy=radiusy-yrotdir
if radiusx<-100
xrotdir=neg(xrotdir)
endif
if radiusy<-300
yrotdir=neg(yrotdir)
endif
if radiusx>300
xrotdir=neg(xrotdir)
endif
if radiusy>300
yrotdir=neg(yrotdir)
endif
;circle orbitx, orbity, 10, 1
sync
Angle=WrapAngle(Angle,spd_rotate)
cls rgb(0,0,0)
goto main
=]
setfps 60
openscreen 1024, 768, 32, 1
fimage=loadnewfximage("ball.bmp")
imagemaskcolour fimage, rgb(255, 255, 255)
NumberOfObjects=32
;circle test
angle=-80
spd_rotate=0.5
radiusx=300
radiusy=300
yrotdir=-2
xrotdir=2
dim balloffset(numberofobjects)
main:
mx=mousex()
my=mousey()
for lp=1 to NumberOfObjects
ThisAngle=Angle+(360.0/NumberOfObjects)*lp
if thisangle=>360
balloffset(lp)=balloffset(lp)-5
endif
if spacekey()
balloffset(lp)=0
endif
ink rgb(0, 0, Angle)
; Calc the position of the oribiting object
OrbitX=mx+(Cos(ThisAngle)*radiusx+dx/2)
OrbitY=my+(Sin(ThisAngle)*radiusy+dy/2)
dx=balloffset(lp)
dy=balloffset(lp)
; display the moving object
;circle OrbitX,OrbitY,10,1
orbitx=orbitx-dx/2
orbity=orbity-dy/3
drawimage fimage, orbitx, orbity, 1
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
drawimage fimage, orbitx, orbity, 1
next
radiusx=radiusx-xrotdir
radiusy=radiusy-yrotdir
if radiusx<-300
xrotdir=neg(xrotdir)
endif
if radiusy<-300
yrotdir=neg(yrotdir)
endif
if radiusx>300
xrotdir=neg(xrotdir)
endif
if radiusy>300
yrotdir=neg(yrotdir)
endif
;circle orbitx, orbity, 10, 1
sync
Angle=WrapAngle(Angle,spd_rotate)
cls rgb(0,0,0)
goto main
Here's a 3d snake
; PROJECT : mathrot
; AUTHOR : NA
; CREATED : 12/16/2011
; EDITED : 12/16/2011
; ---------------------------------------------------------------------
openscreen 1024, 768, 32, 1
SETFPS 75
fimage=loadnewfximage("ball.bmp")
imagemaskcolour fimage, rgb(255, 255, 255)
NumberOfObjects=300
;circle test
angle=-90
spd_rotate=2
radiusx=300
radiusy=300
yrotdir=-2
xrotdir=3
dim balloffset(numberofobjects)
main:
mx=mousex()
my=mousey()
for lp=1 to NumberOfObjects
ThisAngle=Angle+(360.0/NumberOfObjects)*lp
if thisangle=>360
balloffset(lp)=balloffset(lp)-1
endif
if spacekey()
balloffset(lp)=0
endif
ink rgb(0, 0, Angle)
; Calc the position of the oribiting object
OrbitX=mx+(Cos(ThisAngle)*radiusx+dx)
OrbitY=my+(Sin(ThisAngle)*radiusy+dy)
dx=balloffset(lp)
dy=balloffset(lp)
; display the moving object
;circle OrbitX,OrbitY,10,1
orbitx=orbitx-dx/2
orbity=orbity-dy/2
drawimage fimage, orbitx, orbity, 1
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+16
orbity=orbity+16
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+16
orbity=orbity+16
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+16
orbity=orbity+16
drawimage fimage, orbitx, orbity, 1
next
radiusx=radiusx-xrotdir
radiusy=radiusy-yrotdir
if radiusx<-100
xrotdir=neg(xrotdir)
endif
if radiusy<-300
yrotdir=neg(yrotdir)
endif
if radiusx>300
xrotdir=neg(xrotdir)
endif
if radiusy>300
yrotdir=neg(yrotdir)
endif
;circle orbitx, orbity, 10, 1
sync
Angle=WrapAngle(Angle,spd_rotate)
cls rgb(0,0,0)
goto main
Alternate texture, and more nodes:
; PROJECT : mathrot
; AUTHOR : NA
; CREATED : 12/16/2011
; EDITED : 12/16/2011
; ---------------------------------------------------------------------
openscreen 1024, 768, 32, 1
;SETFPS 75
fimage=loadnewfximage("ball2.bmp")
imagemaskcolour fimage, rgb(255, 255, 255)
NumberOfObjects=400
;circle test
angle=-90
spd_rotate=2
radiusx=300
radiusy=300
yrotdir=-2
xrotdir=3
dim balloffset(numberofobjects)
main:
mx=mousex()
my=mousey()
for lp=1 to NumberOfObjects
ThisAngle=Angle+(360.0/NumberOfObjects)*lp
if thisangle=>360
balloffset(lp)=balloffset(lp)-1
endif
if spacekey()
balloffset(lp)=0
endif
ink rgb(0, 0, Angle)
; Calc the position of the oribiting object
OrbitX=mx+(Cos(ThisAngle)*radiusx+dx)
OrbitY=my+(Sin(ThisAngle)*radiusy+dy)
dx=balloffset(lp)
dy=balloffset(lp)
; display the moving object
;circle OrbitX,OrbitY,10,1
orbitx=orbitx-dx/2
orbity=orbity-dy/2
drawimage fimage, orbitx, orbity, 1
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;circle OrbitX,OrbitY,10,1
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
drawimage fimage, orbitx, orbity, 1
next
radiusx=radiusx-xrotdir
radiusy=radiusy-yrotdir
if radiusx<-100
xrotdir=neg(xrotdir)
endif
if radiusy<-300
yrotdir=neg(yrotdir)
endif
if radiusx>300
xrotdir=neg(xrotdir)
endif
if radiusy>300
yrotdir=neg(yrotdir)
endif
;circle orbitx, orbity, 10, 1
sync
Angle=WrapAngle(Angle,spd_rotate)
cls rgb(0,0,0)
goto main
3d Millipede using smart coloring on the texture.
Screenshot Worthy
; PROJECT : mathrot
; AUTHOR : NA
; CREATED : 12/16/2011
; EDITED : 12/16/2011
; ---------------------------------------------------------------------
openscreen 1024, 768, 32, 1
;SETFPS 75
fimage=loadnewfximage("body.bmp")
head=loadnewfximage("head.bmp")
imagemaskcolour fimage, rgb(255, 255, 255)
imagemaskcolour head, rgb(255, 255, 255)
NumberOfObjects=100
;circle test
angle=-90
spd_rotate=2
radiusx=300
radiusy=300
yrotdir=-2
xrotdir=3
dim balloffset(numberofobjects)
main:
mx=mousex()
my=mousey()
for lp=1 to NumberOfObjects
ThisAngle=Angle+(360.0/NumberOfObjects)*lp
if thisangle=>360
balloffset(lp)=balloffset(lp)-1
endif
if spacekey()
balloffset(lp)=0
endif
ink rgb(0, 0, Angle)
; Calc the position of the oribiting object
OrbitX=mx+(Cos(ThisAngle)*radiusx+dx)
OrbitY=my+(Sin(ThisAngle)*radiusy+dy)
dx=balloffset(lp)
dy=balloffset(lp)
; display the moving object
;circle OrbitX,OrbitY,10,1
orbitx=orbitx-dx/2
orbity=orbity-dy/2
if lp=100
print orbitx
print orbity
drawimage head, orbitx, orbity, 1
else
drawimage fimage, orbitx, orbity, 1
endif
;circle OrbitX,OrbitY,10,1
;drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;circle OrbitX,OrbitY,10,1
;drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;drawimage fimage, orbitx, orbity, 1
next
radiusx=radiusx-xrotdir
radiusy=radiusy-yrotdir
if radiusx<-100
xrotdir=neg(xrotdir)
endif
if radiusy<-300
yrotdir=neg(yrotdir)
endif
if radiusx>300
xrotdir=neg(xrotdir)
endif
if radiusy>300
yrotdir=neg(yrotdir)
endif
;circle orbitx, orbity, 10, 1
sync
Angle=WrapAngle(Angle,spd_rotate)
cls rgb(0,0,0)
goto main
This one is REALLY cool. hehe.. most fun I've had with playbasic in forever.
very nice ^__^
Here's a Chinese Dragon. The texture isn't that great.
It's a sprite paint of this dragon. (http://www.justsymbol.com/images/chinese-dragon-symbol-15.jpg)
; PROJECT : Dragon
; AUTHOR : NA
; CREATED : 12/16/2011
; EDITED : 12/17/2011
; ---------------------------------------------------------------------
openscreen 1024, 768, 32, 1
SETFPS 75
fimage=loadnewfximage("body.bmp")
head=loadnewfximage("head.bmp")
imagemaskcolour fimage, rgb(255, 255, 255)
imagemaskcolour head, rgb(255, 255, 255)
NumberOfObjects=100
;circle test
angle=-90
spd_rotate=2
radiusx=300
radiusy=300
yrotdir=-2
xrotdir=3
dim balloffset(numberofobjects)
main:
mx=mousex()
my=mousey()
for lp=1 to NumberOfObjects
ThisAngle=Angle+(360.0/NumberOfObjects)*lp
if thisangle=>360
balloffset(lp)=balloffset(lp)-1
endif
if spacekey()
balloffset(lp)=0
endif
ink rgb(0, 0, Angle)
; Calc the position of the oribiting object
OrbitX=mx+(Cos(ThisAngle)*radiusx+dx)
OrbitY=my+(Sin(ThisAngle)*radiusy+dy)
dx=balloffset(lp)
dy=balloffset(lp)
; display the moving object
;circle OrbitX,OrbitY,10,1
orbitx=orbitx-dx/2
orbity=orbity-dy/2
if lp=100
print orbitx
print orbity
drawimage head, orbitx, orbity, 1
else
drawimage fimage, orbitx, orbity, 1
endif
;circle OrbitX,OrbitY,10,1
;drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;circle OrbitX,OrbitY,10,1
;drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;drawimage fimage, orbitx, orbity, 1
orbitx=orbitx+32
orbity=orbity+32
;drawimage fimage, orbitx, orbity, 1
next
radiusx=radiusx-xrotdir
radiusy=radiusy-yrotdir
if radiusx<-100
xrotdir=neg(xrotdir)
endif
if radiusy<-300
yrotdir=neg(yrotdir)
endif
if radiusx>300
xrotdir=neg(xrotdir)
endif
if radiusy>300
yrotdir=neg(yrotdir)
endif
;circle orbitx, orbity, 10, 1
sync
Angle=WrapAngle(Angle,spd_rotate)
cls rgb(0,0,0)
goto main
like, new year - year of dragon
yeah. I didn't do very good on the head.. but oh well.=p it's there to see
I just got some interesting ideas. so I went ahead