All pastes #817555 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-15 18:07 UTC
rendered paste body
Type Particle Extends Entity

	Field Sprite:TImage
	Field x:Float = 0
	Field y:Float = 0
	Field width:Float = 100
	Field height:Float = 100
	
	Field red:Int = 255
	Field green:Int = 255
	Field blue:Int = 255
	
	Method New() 
		Objects.AddLast(Self) 
	End Method
	
	Method Think() 

	End Method
	
	Method Draw() 
		SetColor(red, green, blue) 
		SetScale(width / Sprite.width, height / Sprite.height) 
		SetBlend(ALPHABLEND) 
		DrawImage(Sprite, x, y) 
	End Method
	
	Method SetSize(wwidth:Float, hheight:Float) 
		width = wwidth
		height = hheight
	End Method
	
	Method SetPos(xx:Float, yy:Float) 
		x = xx
		y = yy
	End Method
	
	Method SetImage(image:TImage) 
		Sprite = image
	End Method
	
	Method SetColour(r:Int, g:Int, b:Int) 
		red = r
		green = g
		blue = b
	End Method
	
	Function Create:Particle(x:Float, y:Float, width:Float, height:Float, red:Int, green:Int, blue:Int, Sprite:TImage) 
		Local p:Particle = New Particle
		p.SetPos(x, y) 
		p.SetSize(width, height) 
		p.SetImage(Sprite) 
		p.SetColour(red, green, blue) 
		Return p
	EndFunction
	
EndType