Hi everyone :)
I would like to share with you some work I've done. I work on a simple particles system to provide the ability to create some effects for projects, in an easy way.
The aim of this is to be able to create what we want, easly (I don't know if in english, we can say that, I hope you understand what I mean lol).
So here's some examples, I will compile them together to make one I will share in the app section :)
I have not finished yet, but that works. It's not a "mega framework" or something, this is just a code I will share for those want to make some particles with ease.
The demo is on the App sectio here : http://www.monkeycoder.co.nz/Community/topics.php?forum=1200&app_id=200
The code used to create these demo look like this one, but it is not really the final code, because I have to make some things go away from the "main code".
port mojo
Import diddy
Import cps
Global cpsdemo
Global seed
Class CpsParticlesDemo Extends App
Field img_Part:Image
Field img_House:Image
Field listPart:List<cpsParticles>
Field myPart:cpsParticles
Method OnCreate:Int()
SetUpdateRate(60)
seed = RealMillisecs()
listPart = New List<cpsParticles>
img_Part = LoadImage("smoke1.png")
img_House = LoadImage("maison.jpg")
Return 0
End
Method OnUpdate:Int()
For Local i = 1 To 6
myPart = New cpsParticles
myPart.Setup(1, 145.0, 76.0, -90.0, 0.0, 0, 1000,
Rnd(100.0), Rnd(100.0), 255, 255, 255, Rnd(200.0), "alpha", 0.0, 0.0015, 0.0, 0.0, 0.005)
listPart.AddLast myPart
Next
Local p:cpsParticles
For p = EachIn listPart
p.UpdatePart(0.0, 640.0, 0.0, 480.0)
Next
Return 0
End
Method OnRender:Int()
Cls(0, 0, 0)
DrawText("*******************************", 220, 80)
DrawText("CPS House Demo By Crystal Noir", 220, 100)
DrawText("*******************************", 220, 120)
DrawImage(img_House, 0, 0)
Local x:Int = 0
For Local p:cpsParticles = EachIn listPart
If p.active = 1
p.Display(img_Part)
Else
listPart.Remove p
EndIf
Next
Return 0
End
End
Hope you will like it :) (And sorry for my english)
|