Screensaver

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

Re: Screensaver

Postby tintran » Sat Oct 15, 2011 8:22 pm

change canvas->Create Actor->Script to
Code: Select all
int loop;
init();
for (loop=0;loop<LINES;loop++)  run();
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby EvanBlack » Sat Oct 15, 2011 8:56 pm

cool, also instead of using DrawActor event for run(). It would probably be better to switch it to a timer, but there is a noticable pause as the screen saver starts but it stops run from being called more then it has too. Also allows for the lines to scroll smoother and not slow down at certain parts. This is probably dependant of computer, the FPS drop.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: Screensaver

Postby Game A Gogo » Sat Oct 15, 2011 11:56 pm

cos, and sin returns values from -1 to 1, so if I add 1 to it, it will give me a value from 0 to 2.
now the multipliers are there so that over time, the lines won't be always the same color!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Screensaver

Postby tintran » Sun Oct 16, 2011 1:21 am

also if you increment variable tick by 5 or 6 or even 10, you get some really nice gradients.
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby tintran » Sun Oct 16, 2011 6:50 pm

star field
Code: Select all
#define STARS 1000
#define MAXDEPTH 50
#define SPEED .5
float X[STARS],Y[STARS],Z[STARS],OZ[STARS];
int i;
double midx,midy;
void init()
{
  midx = 1.0*view.width/2;
  midy = 1.0*view.height/2;
  for (i=0;i<STARS;i++)
  {
      X[i] = rand(view.width*MAXDEPTH)-view.width*MAXDEPTH/2;
      Y[i] = rand(view.height*MAXDEPTH)-view.height*MAXDEPTH/2;
      Z[i] = rand(MAXDEPTH)+1;
      OZ[i] = Z[i];
  }
}

void run()
{
 
  for (i=0;i<STARS;i++)
  {
      OZ[i] = Z[i];
      Z[i]-=SPEED;
      if (Z[i]<=0) Z[i] = MAXDEPTH;
  }
 
  for (i=0;i<STARS;i++)
  {
    //erase stars
    setpen(0,0,0,0,1);
    moveto(midx + X[i]/OZ[i],        midy + Y[i]/OZ[i]);
    lineto(midx + X[i]/(OZ[i]+SPEED),midy + Y[i]/(OZ[i]+SPEED));
 
    //draw stars
    setpen(255-Z[i]*5,255-Z[i]*5,255-Z[i]*5,0,1);
    moveto(midx + X[i]/Z[i],        midy + Y[i]/Z[i]);
    lineto(midx + X[i]/(Z[i]+SPEED),midy + Y[i]/(Z[i]+SPEED));
  }
 
}
Attachments
stars.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby Jagmaster » Mon Oct 17, 2011 12:50 am

:shock: Awesome!
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Screensaver

Postby jimmynewguy » Mon Oct 17, 2011 1:43 am

Trintran, these look sweet. But your run for the starfield would be faster with this.

Code: Select all
void run()
{
   erase(0, 0, 0, 1);
  for (i=0;i<STARS;i++)
  {
      OZ[i] = Z[i];
      Z[i]-=SPEED;
      if (Z[i]<=0) Z[i] = MAXDEPTH;
  }

  for (i=0;i<STARS;i++)
  {
    //draw stars
    setpen(255-Z[i]*5,255-Z[i]*5,255-Z[i]*5,0,1);
    moveto(midx + X[i]/Z[i],        midy + Y[i]/Z[i]);
    lineto(midx + X[i]/(Z[i]+SPEED),midy + Y[i]/(Z[i]+SPEED));
  }
}
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Screensaver

Postby tintran » Mon Oct 17, 2011 6:51 pm

nice, it means i can get rid of OZ as well. :)
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby 157pl » Wed Oct 19, 2011 10:40 pm

wow thanks i have made multiple things i wished i could use as screen savers but i never thought i could :shock:
User avatar
157pl
 
Posts: 109
Joined: Thu May 13, 2010 10:49 pm
Location: AZ
Score: 3 Give a positive score

Re: Screensaver

Postby 157pl » Thu Oct 20, 2011 1:20 am

i made a fiew
the clock uses Hblade's 24 hr clock code :D
Attachments
screensavers.zip
(1.92 MiB) Downloaded 172 times
User avatar
157pl
 
Posts: 109
Joined: Thu May 13, 2010 10:49 pm
Location: AZ
Score: 3 Give a positive score

Re: Screensaver

Postby 157pl » Sat Oct 22, 2011 5:31 pm

we should put this file extension under the export tab thing so people will know you can do it
User avatar
157pl
 
Posts: 109
Joined: Thu May 13, 2010 10:49 pm
Location: AZ
Score: 3 Give a positive score

Re: Screensaver

Postby tintran » Sun Dec 04, 2011 12:31 am

bezier curve screen saver :)
Attachments
bezierCurveScreenSaver.ged
(5.64 KiB) Downloaded 176 times
beziercurvescreeensaver.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby SuperSonic » Sun Dec 04, 2011 1:54 am

Dude, that's awsome :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Screensaver

Postby tintran » Sun Dec 04, 2011 10:18 pm

8 beziers :D
Attachments
8bezier.ged
(6.93 KiB) Downloaded 164 times
8bezier.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

Re: Screensaver

Postby tintran » Mon Dec 05, 2011 12:21 am

A higher order bezier curve (4th order, defined by 5 points).
(and a 6th order bezier, defined by 7 points)
Attachments
bezierCurveHO7ScreenSaver.ged
(10.66 KiB) Downloaded 161 times
6thorderbezier.png
bezierCurveHOScreenSaver.ged
(8.49 KiB) Downloaded 174 times
4thorderbezier.png
User avatar
tintran
 
Posts: 157
Joined: Fri Dec 24, 2010 1:34 am
Score: 30 Give a positive score

PreviousNext

Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest

cron