Crystal Particle System WIP

Monkey Forums/Monkey Programming/Crystal Particle System WIP

DarkyCrystal(Posted 2012) [#1]
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)


DarkyCrystal(Posted 2012) [#2]
Hi,

I have updated the first. I've done a global demo that is available in the app section now.

I made some changes on my cps class, it's not ready yet, but I go foward :)

In fact this is a small class, that make some calculations, we just have to give parameters needed. A small simple class, not a "big project" but may be it could help :)


MikeHart(Posted 2012) [#3]
Thanks for the effort you have put into this. Will look at the demo when it is reviewed.


MikeHart(Posted 2012) [#4]
Looks really good!


DarkyCrystal(Posted 2012) [#5]
Thank you :) I change some code in my class, trying to make it the more easy to use. When it will finished, if someone want to use it and modify it, he will be able to if he want.

The aim is not to make something "locked". Just a start to work with :)


Qcat(Posted 2012) [#6]
Looking Fantastic!


DarkyCrystal(Posted 2012) [#7]
thank's :) The setup process is a little longer because of parameters, I'm going to dispatch the process.