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.

Code Snippets / cool night vision efect (not original)

Author
Message
Gamer Making
18
Years of Service
User Offline
Joined: 20th Sep 2006
Location: sitting at the comp programming
Posted: 24th Oct 2006 02:48
sync on
sync rate 0
set display mode 320,240,16
brush$="rnddots"
size=320
size2=240
strengh=20
background_color=rgb(0,0,0)

gosub draw
get image 1,0,0,320,240
save image "img1.bmp",1
delete image 1
cls
gosub draw
get image 1,0,0,320,240
save image "img2.bmp",1
delete image 1
cls
gosub draw
get image 1,0,0,320,240
save image "img3.bmp",1
delete image 1
cls
gosub draw
get image 1,0,0,320,240
save image "img4.bmp",1
delete image 1
cls
ink rgb(0,128,0),0
box 0,0,10,10
get image 1,0,0,10,10
save image "img5.bmp",1
delete image 1
cls

sync rate 60
set display mode 640,480,32

for x=1 to 20
make object box x,rnd(10),rnd(10),10
position object x,rnd(100),0,rnd(100)
next x
load image "img1.bmp",1
load image "img2.bmp",2
load image "img3.bmp",3
load image "img4.bmp",4
load image "img5.bmp",5
imgtext=1
sprite 1,0,0,imgtext
size sprite 1,screen width(),screen height()
set sprite alpha 1,50

sprite 2,0,0,5
size sprite 2,screen width(),screen height()
set sprite alpha 2,50

color backdrop 0
do
set cursor 0,0
print "press 1 to turn nivi on"
print "press 2 to turn nivi off"
print "fps: ",screen fps()
print "display mode 640,480,32"
if inkey$()="1" then nivi=1
if inkey$()="2" then nivi=0

if nivi=1
show sprite 1
show sprite 2
inc screen_over_time
if screen_over_time=4 then inc imgtext : screen_over_time=0
if imgtext>4 then imgtext=1
sprite 1,0,0,imgtext
else
hide sprite 1
hide sprite 2
endif

control camera using arrowkeys 0,0.5,0.5

sync
loop


draw:
for x=1 to size : for y=1 to size2
if brush$="rnddots" then rndx=(rnd(size)) : rndy=(rnd(size2))
color=point(rndx,rndy)
r=rgbr(color)+strengh
g=rgbg(color)+strengh
b=rgbb(color)+strengh
if r>255 then r=255
if g>255 then g=255
if b>255 then b=255
ink rgb(r,g,b),background_color
if brush$="rnddots" then dot rndx,rndy
next x : next y
return

(this is the media)

load image "img1.bmp",1
load image "img2.bmp",2
load image "img3.bmp",3
load image "img4.bmp",4
load image "img5.bmp",5
imgtext=1
sprite 1,0,0,imgtext
size sprite 1,screen width(),screen height()
set sprite alpha 1,50

sprite 2,0,0,5
size sprite 2,screen width(),screen height()
set sprite alpha 2,50
rem nivi=1

+++ in loop: +++

if nivi=1
show sprite 1
show sprite 2
inc screen_over_time
if screen_over_time=4 then inc imgtext : screen_over_time=0
if imgtext>4 then imgtext=1
sprite 1,0,0,imgtext
else
hide sprite 1
hide sprite 2
endif

(copy after you copy media)

Bach Tran
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Oct 2006 06:13
Gamer Making if you highlight all your code as you would when coping it, then click on the code button(top right) , it will then have the code [] put in so then we can use the code snippet button.

Dark Physics makes any hot drink go cold.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 25th Oct 2006 11:33
That's a bizarre code snippet if ever I saw one.

Quote: "+++ in loop: +++"


Quote: "(copy after you copy media)"


What? If part of your code should be in the main loop, then put it in the main loop. If your code requires external media, then attach the media file. If the media is created internally, then there shouldn't be any need for the code to be split into sections that need assembling.

Try posting your code snippet again, in [c0de] [/c0de] tags as you can see everyone else does, in such a way that it can be copied, pasted into the ide, and executed in one go.

Login to post a reply

Server time is: 2024-11-22 23:27:23
Your offset time is: 2024-11-22 23:27:23