Unlimited Bob's

The place for any Hollywood tutorials
Post Reply
jalih
Posts: 276
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Unlimited Bob's

Post by jalih »

Here is another old school effect...

You need some ball image of your own as brush 6, have fun!

Code: Select all

; Unlimited Bob's in Hollywood
;
; Based on Processing example by Luis2048
;
@DISPLAY {Width = 360, Height = 240, Title = "Unlimited Bob's"}


@BRUSH 6, "ball.png", {LoadAlpha =  True}


CreateBrush(0, GetAttribute(#DISPLAY,1,#ATTRWIDTH), GetAttribute(#DISPLAY,1,#ATTRHEIGHT))
CreateBrush(1, GetAttribute(#DISPLAY,1,#ATTRWIDTH), GetAttribute(#DISPLAY,1,#ATTRHEIGHT))
CreateBrush(2, GetAttribute(#DISPLAY,1,#ATTRWIDTH), GetAttribute(#DISPLAY,1,#ATTRHEIGHT))
CreateBrush(3, GetAttribute(#DISPLAY,1,#ATTRWIDTH), GetAttribute(#DISPLAY,1,#ATTRHEIGHT))
CreateBrush(4, GetAttribute(#DISPLAY,1,#ATTRWIDTH), GetAttribute(#DISPLAY,1,#ATTRHEIGHT))
CreateBrush(5, GetAttribute(#DISPLAY,1,#ATTRWIDTH), GetAttribute(#DISPLAY,1,#ATTRHEIGHT))


bob = {x = 0, y = 0, xang = 0, yang = 0, surf = 0}


Function bob:draw()
	self.x = (GetAttribute(#BRUSH,0,#ATTRWIDTH)/2)*Sin((Rad(self.xang))*0.95)
	self.y = (GetAttribute(#BRUSH,0,#ATTRHEIGHT)/2)*Cos((Rad(self.yang))*0.97)
	
	self.xang = self.xang + 1.17
	self.yang = self.yang + 1.39
	
	SelectBrush(self.surf)
	DisplayBrush(6, #CENTER + self.x, #CENTER + self.y, { AnchorX = 0.5, AnchorY = 0.5 })
	EndSelect
	
	DisplayBrush(self.surf, 0, 0)
	
	self.surf = self.surf + 1
	self.surf = Wrap(self.surf, 0, 6)
	
EndFunction




Function p_MainLoop()
	bob:draw()
	Flip()
EndFunction




EscapeQuit(True)

BeginDoubleBuffer()


SetInterval(1, p_MainLoop, 1000/50) ; 50fps

Repeat
	WaitEvent
Forever
Post Reply