Main Menu

Particle Effects- 3d starfield

Started by monkeybot, February 03, 2009, 08:53:42 AM

Previous topic - Next topic

monkeybot

i knocked this up with 1.63w2

3d starfield with gravity effect and hyperspace

New version with a wipe
version 1.1 full screen seems to run at full speed

kevin


Looks pretty good, although seems a tad familiar :)

monkeybot

originality was never my strong point

did you press g?

kevin

 yeah, I did play the controls a bit

monkeybot

#4
Hmm for some reason when deployed the starfield seems to run very slowly(6 fps) until i press T or G.......

yet it doesn't do it when compiled from the IDE

only 1 more post to my 100th woohoo

kevin


that one's a lot slower than other version

monkeybot

#6
hmm - if you press G or T it reverts to full speed

monkeybot


[/quote]
Quote from: monkeybot on February 03, 2009, 09:47:03 AM
Hmm for some reason when deployed the starfield seems to run very slowly(6 fps) until i press T or G.......

yet it doesn't do it when compiled from the IDE



kevin

 Rather than double posting (you 101 poster you), wouldn't it be more useful to post the code. 

monkeybot


micky4fun

hi Monkeybot

nice demo , like gravity effect works well very effective m would like to see the code for this if posssible

mick :)

kevin

Quote from: monkeybot on February 03, 2009, 03:11:00 PM
i would be all embarrassed

There's nothing to worried about.  The more people contributing snippets (big or small), the more knowledge and ideas can be shared.

monkeybot

ok i will tidy it up a bit and post soon(ish)

micky4fun


monkeybot

#14
This is very rough,but hey i am busy.......
PlayBASIC Code: [Select]
; PROJECT : blob emiiter v 1.0
; AUTHOR : Monkeybot
; CREATED : 02/02/2009
; EDITED : 11/03/2009
; ---------------------------------------------------------------------

; ---------------------------------------------------------------------
;to do


explicit on
;screenvsync off
local num=1000
global width=getscreenwidth()
global height=getscreenheight()
constant border=0
constant xborder=50
Constant gravityVal#=0.5
global originX=width/2
global originY=height/2
global trailtimer=timer()
global gamespeed#=1
global offsetXVector#
global offsetYVector#
global offsetAngle=0

global hx,hy,h2x,h2y


type particle
x#
y#
ang
speed#
xVector#
yVector#
PathDistance#
gravityFlag
size#
TrailFlag
trailStartX#
trailStartY#
endtype
dim object(num) as particle
print "Working..............."
sync
local q,buttonflag,w
offsetXVector#=0
offsetYVector#=0
for q=0 to num-1
pokedata (q)
next
;initiate random stars
for w=0 to 100;000
;print w
; sync
for q=0 to num-1
doblobNoGfx(q)
next
next
setfps(50)
repeat
cls 0
if (203=scancode()) then offsetAngle=offsetAngle-5;offsetXVector#
if (205=scancode()) then offsetAngle=offsetAngle+5

offsetXVector#=cos(offsetAngle)*5;object(index).speed#
offsetYVector#=sin(offsetAngle)*5;object(index).speed#
select mousebutton()
case 0
if gamespeed#>0.5 then gamespeed#=gamespeed#-0.01
case 1
if gamespeed#<6 then gamespeed#=gamespeed#+0.2
case 2
if gamespeed#>0.5 then gamespeed#=gamespeed#-0.2
endselect

lockbuffer
;cls 0
for q=0 to num-1
doblob(q)
next
ink $00;ff00
box 0,0,width,xborder,1
box 0,height-(xborder-1),width,height,1
box 0,0,xborder,height,1
box width-(xborder+1),0,width,height,1
ink $ffffff
box xborder,xborder,width-xborder,height-xborder,0
print "Num of particles "+str$(num)+" fps "+str$(fps())+" Speed "+str$(gamespeed#)
print "left/right mouse speed up/down "+str$(offsetAngle)
print "Key G - For grav effect // Key T for Warp // Q-Quit"
if timer()<trailtimer+500 then print "timer active"


local x1,y1,x2,y2,length=100
x1=cos(offsetAngle)*(length/2)
y1=sin(offsetAngle)*(length/2)
x2=cos(offsetAngle)*(length/2)
y2=sin(offsetAngle)*(length/2)
ink $ff
line (width/2)-x1,(height/2)-y1,(width/2)+x2,(height/2)+y2
circle (width/2),(height/2),4,2
circle(width/2)-x1,(height/2)-y1,4,2
circle(width/2)+x2,(height/2)+y2,4,2
unlockbuffer
sync
until (1=scancode()) or (16=scancode()) ;esc/q
waitnokey
; repeat
setfps(250);c
lockbuffer
for q=0 to height/2 step 1
ink $fffffff
box 0+q+1,0+q+1,width-q-1,height-q-1,0
ink 0
box 0+q,0+q,width-q,height-q,0
sync

ink $fffffff
box 0+q+1,0+q+1,width-q-1,height-q-1,0
ink 0
box 0+q,0+q,width-q,height-q,0
sync
next
unlockbuffer
ink $ffffff
local size
setfps(30)
cls 0
sync
cls 0
for size=0 to 20
line (width/2)-size,(height/2),(width/2)+size,(height/2)
line (width/2),(height/2)-size,(width/2),(height/2)+size
sync
next
for size=20 to 0 step-1
cls 0
line (width/2)-size,(height/2),(width/2)+size,(height/2)
line (width/2),(height/2)-size,(width/2),(height/2)+size
sync
next
cls 0
end


Function doblob(index)
Login required to view complete source code