The Game Creators
The Game Creators Home Online Shop Click to Login
  Hot: Christmas CompetitionNovember NewsletterModel Pack 36DB Pro Pack 2009DGS BonanzaCharacter PackFPS Creator Bonanza;
The Game Creators
20 Liners / Pointless Dot Fun

Go to the first page of this board Return to the Forum Menu Post Message
7 Messages - Page   of 1   
Bookmark and Share Search the Forum

Author Message
razerx

User


Joined: Sun Mar 22nd 2009
Location: Code Cave, USA
Posted: 23rd Oct 2009 21:02     Edited: 27th Oct 2009 21:10     | link | toggle

DBC


[edit]
I just noticed(looking at the two locked treads) that the title for this thread is not very good. What I meant to call it was somthing like "Not a game but is cool and fun to play around with".[/edit]


I was just messing around with new functions I found and thought that I'd do my first 20 line-er. It's not a game yet, but is cool, and can easily be a game. So feel free to make your own game out of it.

+ Code Snippet
set display mode 800,600,32:Sync On:Sync rate 0:ink rgb(140,180,255),0:dim mx(100):dim my(100):dim a#(100):dim x#(100):dim y#(100):dim size(100):dim speed(100)
dim out(100):maxcircles=60:maxsize=50:for n=1 to 100:x=rnd(1)+1:y=rnd(1)+1:if x=1:x#(n)=rnd(400)-800:else:x#(n)=rnd(440)+1090:endif:if y=1:y#(n)=rnd(300)-600
else:y#(n)=rnd(340)+690:endif:size(n)=rnd(4)+4:speed(n)=rnd(5)+3:mx(n)=mousex():my(n)=mousey():next n:DO:for n=1 to maxcircles:if out(n)=1:x=rnd(1)+1:y=rnd(1)+1
if x=1:x#(n)=rnd(400)-800:else:x#(n)=rnd(440)+1090:endif:if y=1:y#(n)=rnd(300)-600:else:y#(n)=rnd(340)+690:endif:size(n)=rnd(4)+4:speed(n)=rnd(5)+3:mx(n)=mousex()
my(n)=mousey():out(n)=0:endif:if mouseclick()=1:mx(n)=mousex():my(n)=mousey():if speed(n)>0:speed(n)=speed(n)*-1:endif:else:if speed(n)<0:speed(n)=speed(n)*-1
endif:if size(n)<maxsize:mx(n)=mousex():my(n)=mousey():endif:endif:if abs(mx(n)-x#(n))>7 or abs(my(n)-y#(n))>7:a#(n)=atanfull(mx(n)-x#(n),my(n)-y#(n))
x#(n)=x#(n)+sin(a#(n))*speed(n):y#(n)=y#(n)+cos(a#(n))*speed(n):else:if size(n)=maxsize:mx(n)=rnd(900)-100:my(n)=rnd(700)-100:endif:endif:x1=x#(n):y1=y#(n)
rad1=size(n):for n2=1 to maxcircles:if n2<>n and out(n)=0 and out(n2)=0:x2=x#(n2):y2=y#(n2):rad2=size(n2):if circleover(x1,y1,rad1,x2,y2,rad2)=1:if size(n)>size(n2)
if size(n)<maxsize:size(n)=size(n)+size(n2)-2:out(n2)=1:endif:endif:if size(n)<=size(n2):if size(n2)<maxsize:size(n2)=size(n2)+size(n)-2:out(n)=1:endif:endif
endif:endif:next n2:if size(n)>maxsize:size(n)=maxsize:endif:x=x#(n):y=y#(n):size=size(n):if size(n)=maxsize:ink rgb(100,100,255),0:else:ink rgb(140,180,255),0
endif:if circlemouseover(x,y,size):ink rgb(255,0,0),0:endif:circle x#(n),y#(n),size(n):next n:sync:cls:LOOP
function circlemouseover(x,y,rad)
 mx=mousex() : my=mousey():dist#=distance#(mx,my,x,y):if dist#<=rad:exitfunction 1:endif
endfunction 0
function circleover(x1,y1,rad1,x2,y2,rad2)
 dist#=distance#(x1,y1,x2,y2):if dist#<=rad1+rad2:exitfunction 1:endif
endfunction 0
function distance#(x1,y1,x2,y2)
 dist#=abs(sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))))
endfunction dist#


Mess with maxcircles and maxsize to change it up a bit.

-Maxcircles controls how many circles are on the map at a time.

-Maxsize is the radius needed for the circles to start moveing around randomly and stop effecting the other circles.

-Click on the mouse for a repel effect.

-Red circles means your mouse is inside the circle.
-Dark blue circles are the fully grown ones.

Here is the uncommpressed version which is still a little messy since I was just messing around:

+ Code Snippet
set display mode 800,600,32
Sync On:Sync rate 0
ink rgb(140,180,255),0

dim mx(100)
dim my(100)
dim a#(100)
dim x#(100)
dim y#(100)
dim size(100)
dim speed(100)
dim out(100)

maxcircles=60
maxsize=50

for n=1 to 100
 x=rnd(1)+1
 y=rnd(1)+1

 if x=1
  x#(n)=rnd(400)-800
 else
  x#(n)=rnd(440)+1090
 endif

 if y=1
  y#(n)=rnd(300)-600
 else
  y#(n)=rnd(340)+690
 endif

 size(n)=rnd(4)+4
 speed(n)=rnd(5)+3
 mx(n)=mousex():my(n)=mousey()
next n

DO
 for n=1 to maxcircles

  if out(n)=1
   x=rnd(1)+1
   y=rnd(1)+1

   if x=1
    x#(n)=rnd(400)-800
   else
    x#(n)=rnd(440)+1090
   endif

   if y=1
    y#(n)=rnd(300)-600
   else
    y#(n)=rnd(340)+690
   endif

   size(n)=rnd(4)+4
   speed(n)=rnd(5)+3
   mx(n)=mousex():my(n)=mousey()
   out(n)=0
  endif

  if mouseclick()=1
   mx(n)=mousex():my(n)=mousey()
   if speed(n)>0 then speed(n)=speed(n)*-1
  else
   if speed(n)<0 then speed(n)=speed(n)*-1
   if size(n)<maxsize then mx(n)=mousex():my(n)=mousey()
  endif
   `calculate
   if abs(mx(n)-x#(n))>7 or abs(my(n)-y#(n))>7
      a#(n) =atanfull(mx(n)-x#(n),my(n)-y#(n))
      x#(n) = x#(n) + sin(a#(n))*speed(n)
      y#(n) = y#(n) + cos(a#(n))*speed(n)
   else
    if size(n)=maxsize then mx(n)=rnd(900)-100:my(n)=rnd(700)-100
   endif
   `collision
   
   x1=x#(n)
   y1=y#(n)
   rad1=size(n)

   for n2=1 to maxcircles
    if n2<>n and out(n)=0 and out(n2)=0
     x2=x#(n2)
     y2=y#(n2)
     rad2=size(n2)

     if circleover(x1,y1,rad1,x2,y2,rad2)=1
      if size(n)>size(n2)
       if size(n)<maxsize
        size(n)=size(n)+size(n2)-2
        out(n2)=1
       endif
      endif

      if size(n)<=size(n2)
       if size(n2)<maxsize
        size(n2)=size(n2)+size(n)-2
        out(n)=1
       endif
      endif
     endif
    endif
   next n2

   if size(n)>maxsize then size(n)=maxsize

   `draw

   x=x#(n)
   y=y#(n)
   size=size(n)

   if size(n)=maxsize
    ink rgb(100,100,255),0
   else
     ink rgb(140,180,255),0
   endif

   if circlemouseover(x,y,size)
    ink rgb(255,0,0),0
   endif


   circle x#(n),y#(n),size(n)
  next n

   sync:cls
LOOP



function circlemouseover(x,y,rad)
 mx=mousex() : my=mousey()
 dist#=distance#(mx,my,x,y)
 if dist#<=rad then exitfunction 1
endfunction 0

function circleover(x1,y1,rad1,x2,y2,rad2)
 dist#=distance#(x1,y1,x2,y2)
 if dist#<=rad1+rad2 then exitfunction 1
endfunction 0

function distance#(x1,y1,x2,y2)
 dist#=abs(sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))))
endfunction dist#


Razerx
Back to top
Report this message as abusive
TDK

Moderator


Joined: Tue Nov 19th 2002
Location: Tenerife, Spain
Posted: 25th Oct 2009 09:43     Edited: 25th Oct 2009 10:11     | link | toggle

It doesn't have to be a game - as long as it is within the rules of this board... which this is.

The other threads you mention did not so they were locked. Nothing to do with the thread's title.

TDK

Back to top
TDK\'s Web Site
Report this message as abusive
Xsnip3rX

User


Joined: Tue Feb 20th 2007
Location: Washington State
Posted: 27th Oct 2009 06:22           | link | toggle

is this for DBP, DBC, GDK, GDK.net? u might wanna edit ur thread and put a [DBP] or effect to what language it's in in the topic.
Back to top
MythScape - 3D MMORPG
Report this message as abusive
Google Ad
Back to top
 
General Jackson

User


Joined: Wed Jan 21st 2009
Location: Fragmotion and Wings 3d
Posted: 29th Oct 2009 20:00           | link | toggle

This is like a screensaver.

Back to top
Gj Productions
Report this message as abusive
razerx

User


Joined: Sun Mar 22nd 2009
Location: Code Cave, USA
Posted: 30th Oct 2009 16:04           | link | toggle

Ya, it can be turned into one. You could have diffrent colors too.

Question:

How do you turn DB programs into screensavers like the default ones on the computer?

Razerx
Back to top
Report this message as abusive
TDK

Moderator


Joined: Tue Nov 19th 2002
Location: Tenerife, Spain
Posted: 3rd Nov 2009 08:19           | link | toggle

Quote: "How do you turn DB programs into screensavers like the default ones on the computer?"

Compile them into an exe as normal, rename the fie to a .scr file then drop it into the Windows folder (or wherever screensavers live on the OS you are using).

Eg: MyScreenSaver.exe becomes MyScreenSaver.scr.

TDK

Back to top
TDK\'s Web Site
Report this message as abusive
razerx

User


Joined: Sun Mar 22nd 2009
Location: Code Cave, USA
Posted: 3rd Nov 2009 18:56           | link | toggle

Cool it works. Thanks

I put my clock program on it.

Razerx
Back to top
Report this message as abusive

Go to the first page of this board Return to the Forum Menu Post Message
7 Messages - Page   of 1   
Search the Forum

You must be logged-in to post messages to this forum. You can register an account for free. Or click here to login.
Forum Search

Enter a word or phrase to search our Forum for:

Thread Subject Search
Search Phrase:
Search Scope: Entire forum
Just this board
 
Google Forum Search
Search Phrase:
 
Apollo v2.02


Dark Game Studio
Privacy Policy AUP Top of Page