The simple addictive game

By Wims on Nov 22, 2011

In this game, you are the red dot and you need be fast to fall as low as possible. Some kind of powerups are there to help you: 3 purple = 2 holes per line for 6 seconds 3 blue = a pause of 5 seconds 2 green = faster for 5 seconds 2 orange = no floor for 8 seconds 1 grey = smaller hole for 6 seconds

/picwin to run, I dare you to play only once.

alias picwin {
  if ($1 == again) { .timerpicwin* off | hfree -w picwin | initgame | gamestart }
  elseif ($1 == clear) { .timerpicwin* off | hfree -w picwin | window -c @picwinbuf }
  else { initwin | initgame | gamestart }
}
alias -l initwin {
  window -fpdoCB @picwin -1 -1 200 300
  window -fpdCBh @picwinbuf -1 -1 200 300
}
alias -l initgame {
  hadd -m picwin x 100
  hadd picwin y 10
  hadd picwin inair 1
  hadd picwin scroll 0
  hadd picwin maxscroll 40
  drawrect -fr @picwinbuf 16777215 0 0 0 200 300
}
alias -l gamestart {
  .timerpicwindec 0 7 hdec picwin maxscroll 1 $(|) var % $+ r $!r(0,100) $(|) hadd picwin bonus $!iif(%r isnum 0-24,1,$iif(%r isnum 25-49,4,$iif(%r isnum 50-69,2,$iif(%r isnum 70-89,3,5))))
  generate&scroll 3
  hadd picwin start $ticks
  mainloop
}
alias -l bonus {
  if ($hget(picwin,bonus)) {
    drawdot -r @picwinbuf $gettok(10223772 64512 16515072 13816530 32764,$v1,32)) 5 $calc($1 + $iif($hget(picwin,hole),7,12)) 295
    hdel picwin bonus
  }
}
alias -l generate&scroll {
  if (!$hget(picwin,noscroll)) {
    :start
    if (!$hget(picwin,scroll)) && ($r(0,$iif($hget(picwin,hole),190,180)) != $null) {
      var %v $v1,%r $r(0,$iif($hget(picwin,hole),190,180))
      drawline -r @picwinbuf 0 3 0 290 200 290
      drawline -r @picwinbuf 16777215 3 %v 290 $calc(%v + $iif($hget(picwin,hole),10,20)) 290
      if ($hget(picwin,double)) drawline -r @picwinbuf 16777215 3 %r 290 $calc(%r + $iif($hget(picwin,hole),10,20))) 290
      bonus %v
    }
    drawscroll @picwinbuf 0 $iif($1,-40,-1) 0 0 200 300
    if ($1) { tokenize 32 $calc($1 -1) | goto start }
    if (!$hget(picwin,inair)) && ($hget(picwin,y) > 0) hdec picwin y 1
    hadd picwin scroll $iif($hget(picwin,scroll) >= $hget(picwin,maxscroll),0,$calc($v1 +1))
  }
  .timerpicwingen -ho 1 0 generate&scroll
}
alias -l mainloop {
  if ($hget(picwin,y) == 0) {
    if ($input(Score: $calc(($ticks - $hget(picwin,start)) / 1000) $+ $crlf $+ Play again ?,ys,@picwin,Picwin)) picwin again
    else picwin clear   
    return
  }
  var %s $gettok($hget(picwin,stack),1,32),%y $hget(picwin,y) + $iif($hget(picwin,inair),2,0),%x $hget(picwin,x) $iif(%s,$iif($v1 == 37,-,+) $iif($hget(picwin,boost),5,3))
  var %x = $iif(%x < 5,5,$iif(%x > 198,198,%x))
  if ($getdot(@picwinbuf,$calc(%x - 3),%y)) || ($hget(picwin,nofloor)) hadd picwin inair 1
  else hdel picwin inair
  if ($hget(picwin,inair)) && ($getdot(@picwinbuf,$calc(%x - 3),$calc(%y - 3))) && ($v1 != 16777215) {
    var %v $v1
    drawreplace -r @picwinbuf %v 16777215 $calc(%x - 15) $calc(%y - 15) 50 50
    hinc picwin bonus $+ %v
    var %n $hget(picwin,bonus $+ %v)
    if (%v == 10223772) && (%n == 2) hadd -u6 picwin double 1 $iif(del,)
    elseif (%v == 16515072) && (%n == 3) hadd -u5 picwin noscroll 1 $iif(del,)
    elseif (%v == 64512) && (%n == 2) hadd -u5 picwin boost 1 $iif(del,)
    elseif (%v == 32764) && (%n == 3) hadd -u5 picwin nofloor 1 $iif(del,)
    elseif (%v == 13816530) && (%n == 1) hadd -u6 picwin hole 1 $iif(del,)
    if ($v1 == del) hdel picwin bonus $+ %v
  }
  hadd picwin x %x
  if (%y > 288) && (!$hget(picwin,pro)) { hadd -u3 picwin pro 1 | var %r $r(0,100) | hadd picwin bonus $iif(%r isnum 0-34,1,$iif(%r isnum 35-69,2,$iif(%r isnum 70-89,3,5)))) }
  hadd picwin y $iif(%y > 288,288,%y)
  drawcopy -n @picwinbuf 0 0 200 300 @picwin 0 0
  drawdot -nr @picwin 255 5 $hget(picwin,x) $hget(picwin,y)
  drawdot @picwin
  titlebar @picwin $round($calc(($ticks - $hget(picwin,start)) / 1000),1)
  .timerpicwinmain -ho 1 10 mainloop
}
on *:close:@picwin:picwin clear
on *:keydown:@picwin:37,39:tokenize 32 $hget(picwin,stack) | hadd picwin stack $keyval $iif($keyval != $1,$1,$2)
on *:keyup:@picwin:37,39:hadd picwin stack $remtok($hget(picwin,stack),$keyval,32)
Sign in to comment.
IllogicTC   -  Dec 02, 2011

@Wims yeah I gave up on it for the moment. Now I'm trying to hammer out one of those top-down view mindless zombie shooters. So far I've got the main guy, his ability to move around with WASD keys.... and beginning to work on the shooting bit, having a bit of trouble with that though lol.

 Respond  
Wims   -  Nov 28, 2011

thanks MaSouD @IllogicTC yeah well, we discussed this on irc, quite complicated indeed.

 Respond  
MaSOuD   -  Nov 27, 2011

Good job Wims

 Respond  
IllogicTC   -  Nov 25, 2011

@Wims

To make a picwin simulation of a sorter system.

There would be two incoming lanes, which must gap the little boxes as appropriate for their size, that would lead onto a merge to bring them into one. Every box would be given an assigned divert number after merging. Then it would travel down the sorting system, where it would simulate sorting at the appropriate divert for the box. An extension to this would be to actually make it like a full warehouse simulation game, where these 2 incoming lanes would actually have branches leading into them where you will have to manage the "people" placing boxes onto these branches, and also manage the people at the other end of the divert to keep moving product off of the divert. If the divert becomes full, the box will discharge at the end of the sorting system onto a recirculation line, where it would be cycled back over to one of the incoming merge lanes for another go at sorting.

Sounds a bit complicated, eh? lol

 Respond  
Firstmate   -  Nov 25, 2011

Yeah! Thanks, I knew something was wrong, but neither the motivation or time to figure it out.

I did take a look and saw you had an installer, so chances are pretty high that I'd take back my previous comment.

 Respond  
Jethro   -  Nov 25, 2011

in it's easibilityThe word ease is already a noun. Use either> with easeor> at easeI'm uncertain of the word you've had in mind, but you may be looking at the word simplicity instead.

 Respond  
Firstmate   -  Nov 25, 2011

Wims, I believe that is in part due to the setup required to run PacMan. Don't get me wrong, I played it and loved it, but a snippet trumps a script in it's easibility (don't think that's a word, ha) to load.

 Respond  
Wims   -  Nov 25, 2011

thx Jethro but I feel sad knowing that game, that took less than two days of code, got more success than pacman, which took me several rewrites and several month of code..

what is your project IllogicTC?

 Respond  
IllogicTC   -  Nov 24, 2011

I do enjoy your encouragement, but it's really an advanced idea that I once fancied, but never even tried fleshing out. lol

 Respond  
Jethro   -  Nov 24, 2011

The present is a result of the past. :P

 Respond  
IllogicTC   -  Nov 24, 2011

It reminds me to get back on this picwin project I had going though it will probably be broken :( because I believe it's above my capabilities

 Respond  
Jethro   -  Nov 24, 2011

Very nice game. You've outdone yourself, Wims.

 Respond  
IllogicTC   -  Nov 24, 2011

And generally pretty quick to call on for reads and writes! I'm still addicted =|

 Respond  
Wims   -  Nov 24, 2011

Overlooked the edit part sorry, and well yeah hash table are just the best way, in general, for storing information that are related to the same thing, here for a game.

 Respond  
IllogicTC   -  Nov 23, 2011

I already edited to mention it was in fact a feature. lol. I did that before you responded :O

What I meant by that is by providing a way for the game to remember where everything is in relation to each other. Kind of like how a computer uses RAM, to well.... remember stuff. Instead of using variables, like I probably would have. Hahahaa. I'm a fool.

 Respond  
Wims   -  Nov 23, 2011

I was playing that game too on a calculator, but there were no powerup! What do you mean "provide RAM" for the game?

At one point, it lagged. It did not continue scrolling, I just sat there rolling around on the bottom of the screen for a momentIt's not a bug, it's a feature, look at the description of the game :) Any idea for a new powerup?

Thanks for the comments everyone

edit: http://dl.dropbox.com/u/4249275/picwin.png :)

 Respond  
IllogicTC   -  Nov 23, 2011

I rated 10. Not only is it really fun (and therefore has a use!), but was done using some nice concise code, and runs very smoothly. I like Wims' use of hash to provide "RAM" for the game.

 Respond  
yelow79   -  Nov 23, 2011

This game is so simple and very addictive. rated a 9

 Respond  
blackvenomm666   -  Nov 23, 2011

yes illogictc i haven't tried this yet but it sounds like a game i use to have on my calculator in school if you play long enough you can look at anything and it will appear to be moving up or down depending on the direction of the game. try playing the game for half an hour non stop:) then look at something else haha

 Respond  
  -  Nov 23, 2011

lol sweet 10/10 this will keep me busy for a few days at least LOL

 Respond  
IllogicTC   -  Nov 22, 2011

Whooooaaaaaa. I've also noticed if you're staring at this moving for a while, then get a pause.... it acts like an optical illusion, the black lines appear to be moving slightly downward if you stare at one spot. Trippy.

 Respond  
IllogicTC   -  Nov 22, 2011

Score on first try: 101.665. Going for more, of course. Sometimes the simplest games can be the most addictive. Slight issue I ran into:

At one point, it lagged. It did not continue scrolling, I just sat there rolling around on the bottom of the screen for a moment. At first I'm like WTF THERES A BOTTOM WHY!? then it took off again after about 2-3 seconds. All I have running is my browser, which was parked on this page.... and mIRC, to see the script, not even connected to any servers. x.x

Edit: Maybe I hit a pause ball and didn't notice, lol my bad. Also, second run 106.998. Improvement!

 Respond  
Wims   -  Nov 22, 2011

Thanks :)

 Respond  
ProSec   -  Nov 22, 2011

Very impressive. Amazing use of picwin. 9/10.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.