Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / need some help with snow fall

Author
Message
gp009
15
Years of Service
User Offline
Joined: 31st Mar 2011
Location:
Posted: 17th Apr 2011 16:07
using a snow effect code I found posted on the dark basic forums

im trying to get some snow weather effects in the game im working on. most went successfully except I dont want the snow particals to follow the players exact movement. I want them to fall down straight until the go out of a certain radius range of the player
then have the Z position of that partical to be moved back in range of the player.

heres some code ended up with so far but im still playing with the code

note: object 3 is player object

RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Apr 2011 19:08 Edited at: 18th Apr 2011 00:10
It looks like the issue is in the snow_particle() function. When the particle is positioned *each update*, it is based on object 3's position - which is why it moves with object 3. Positioning based on object 3's position should only occur once when the (edit)particle is re/positioned at the top of it's fall.

Placing the current "position object" command inside the If / Endif would do the trick.

Then replace the current "position object" command with a version that is based on the particle's position instead of object 3's position (for example, instead of using OBJECT POSITION X(3), use OBJECT POSITION X(a) ).

As an added note: The Dim rr#(1000+SnowAmount) may be reduced to rr#(SnowAmount) - assuming the other 1000 indexes are not being used: Just remember to subtract 1000 when referencing the Array's index.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Apr 2011 23:17
You could also use the Cloth & Particles commands. Put a box collider around the centre of your action, and the particles will be destroyed as they leave the area.

gp009
15
Years of Service
User Offline
Joined: 31st Mar 2011
Location:
Posted: 18th Apr 2011 03:29
@RiiDii that mostly did the trick except now I got to find a way for snow not to disappear when player falls down faster than the snow, but for now it works well



Quote: "As an added note: The Dim rr#(1000+SnowAmount) may be reduced to rr#(SnowAmount) - assuming the other 1000 indexes are not being used: Just remember to subtract 1000 when referencing the Array's index."


I did that to avoid conflict issues (object does not exist or object already exists errors) when refering to objects as my game will be using quite a few objects, but yes your right I could reduce it.

Quote: "you could also use the Cloth & Particles commands. Put a box collider around the centre of your action, and the particles will be destroyed as they leave the area."


is that a plugin? if so I would consider using it.
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 18th Apr 2011 09:54
weeell... for the starters: SnowSpeed# is not a global variable.

-In.Dev.X: A unique heavy story based shoot'em ~6%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Apr 2011 14:00
Cloth & Particles is now integrated in the latest DBP upgrades, it was made free as of U73.

http://forum.thegamecreators.com/?m=forum_view&t=150625&b=1

Login to post a reply

Server time is: 2026-07-18 06:41:21
Your offset time is: 2026-07-18 06:41:21