comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: AVALANCHE.PRO .... games in IDL FTW
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: AVALANCHE.PRO .... games in IDL FTW [message #69062] Tue, 15 December 2009 05:46 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Reimar Bauer writes:

> you should kill that chapter where you explain "goto"

You know, it's kinda like when you are trying to get
your teenagers to pick up a book now and then. You
can't be too fussy about what gets them excited.
It's the passion that pushes them along.

I predict we will see more programs by this young
man with fewer GoTos, and maybe even some instructions,
soon. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: AVALANCHE.PRO .... games in IDL FTW [message #69064 is a reply to message #69062] Tue, 15 December 2009 01:12 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
David Fanning schrieb:
> munka writes:
>
>> So, I don't really have any questions. I'm just here to share the
>> wealth and show y'all this program.
>>
>> Also, all this was possible because of Dr. Fanning's amazingly helpful
>> website ;)
>
> Gosh, I feel like a proud grandpa. But I didn't realize I would
> feel just as ignorant and confused as that day, long ago, when
> I held my firstborn for the first time, trying to make out which
> end was up, and wholly unprepared and surprised by the small
> geyser that suddenly erupted. "Does this thing come with
> instructions!?", I wondered both then and now.
>
> But no, you are just suppose to figure things out as you
> go along. I'm not sure it's the *best* system the Universe
> could have evolved, but I guess it works, more or less. :-)
>
> Cheers,
>
> David
>
>

Hi David

you should kill that chapter where you explain "goto"

cheers
Reimar
Re: AVALANCHE.PRO .... games in IDL FTW [message #69065 is a reply to message #69064] Mon, 14 December 2009 18:12 Go to previous messageGo to next message
b_gom is currently offline  b_gom
Messages: 105
Registered: April 2003
Senior Member
Surely ITT is working on an iGames framework to make game development
easier and faster in IDL 8.0..



On Dec 14, 1:04 am, munka <mynameismu...@gmail.com> wrote:
> If you have ever needed to plot a whole bunch of things, you may of
> put a plot command in a for/while loop.  If you forgot to put
> something like wait,1 in your loop, you might have gotten something
> that looks like an animation almost.  I noticed this, and this
> "animation" in combination with the cursor function, you can make some
> sweet games... like avalanche. I got bored and wrote out this game in
> IDL (It's less than 200 lines!)
>
> I realize there is some crappy programming going on in this program,
> but oh well!  I've only known of IDL (or programming for that matter)
> for less than 3 years. (I'm an undergrad in physics/astronomy)
>
> Stuff like
> for i=0,maxenemies-1,1 do Xenemypos[i]=0.0
> instead of:
> Xenemypos=replicate(0.0,maxenemies)
> and the use of goto statements......... :O
> But don't worry about that....
>
> So,  I don't really have any questions.  I'm just here to share the
> wealth and show y'all this program.  I have a better game written with
> the same... "engine"...... but I've been adding comments to it,
> because it is a bit more complicated. I'll post that on here a
> probably sometime later this week. If you have questions or comments,
> feel free to email me at billfreeman44 [at] yahoo.com. I don't check
> my gmail very often.
>
> Also, all this was possible because of Dr. Fanning's amazingly helpful
> website ;)
>
> Enjoy!
> ~Bill
>
> (and if you look closely, you might even be able to cheat! :D  )
>
> pro avalanche
> ;VARIABLES
> difficulty=1 ;set by user in game (see into game screen)
> levelnum=1
> maxnumlevels=50
> usersizex=.5
> usersizey=.5
> maxenemies=1001
> enemypsym=2
>
> thetime=long(0)
> thekey='string'
> ans='string'
> Xenemypos=fltarr(maxenemies)
> Yenemypos=fltarr(maxenemies)
> Yenemyvel=fltarr(maxenemies)
> Tenemytim=fltarr(maxenemies)
> for i=0,maxenemies-1,1 do Xenemypos[i]=0.0
> for i=0,maxenemies-1,1 do Yenemypos[i]=0.0
> for i=0,maxenemies-1,1 do Yenemyvel[i]=1./10*RANDOMU(S, 1)
> for i=0,maxenemies-1,1 do Tenemytim[i]=0.0
> enemynum=0
> thetime=long(1)
>
> ;INTRO GAME SCREEN
>         plot,[0,100],[0,100],/nodata
>         xyouts,50,60, "AVALANCHE",alignment=.5,charsize=3.5
>         xyouts,50,50, "click a difficulty to begin",alignment=.5,charsize=2.5
>         xyouts,50,45, "hit p to pause (while playing)",alignment=.
> 5,charsize=2
>         xyouts,50,40, "hit any key to EXIT (while playing)",alignment=.
> 5,charsize=1
>         xyouts,25,25, "EASY",alignment=.5,charsize=1
>         xyouts,50,25, "MEDIUM",alignment=.5,charsize=1
>         xyouts,75,25, "HARD",alignment=.5,charsize=1
>
> ;GET DIFFICULTY
>         cursor,xpos,ypos,/up
>         if abs(xpos-25) lt abs(xpos-50) and abs(xpos-25) lt abs(xpos-75) then
> difficulty=1
>         if abs(xpos-50) lt abs(xpos-25) and abs(xpos-50) lt abs(xpos-75) then
> difficulty=2
>         if abs(xpos-75) lt abs(xpos-25) and abs(xpos-75) lt abs(xpos-50) then
> difficulty=3
>         plot,[0,100],[0,100],/nodata
>         if difficulty eq 1 then xyouts,50,50, "EASY",charsize=2
>         if difficulty eq 2 then xyouts,50,50, "MEDIUM",charsize=2
>         if difficulty eq 3 then xyouts,50,50, "HARD",charsize=2
>         WAIT,1
>
> while levelnum lt maxnumlevels do begin
>
> levelstart:
> ;LEVEL VARIABLES...
>         levellength=long(320);length of level in frames
>         diffnum=100.;fix(35+levelnum*1.5+difficulty*2);percent chance of
> enemy spawn
>
> ;LEVEL BEGIN
>         for thetime=long(0),long(levellength),1 do begin
>
> ;DRAW LEVEL
>         plot,[0,100],[0,100],/nodata,xminor=1,yminor=1,xmargin=[0,0] ,ymargin=
> [0,0],ticklen=0,xticks=1,yticks=1
>
> ;DRAW SCORE
>         xyouts,2,98, "score = "+strcompress(string(fix(((levelnum+float
> (thetime)/float(levellength))*1000.-1000.)*difficulty)))
>
> ;INTRO TO EACH LEVEL..
>         if thetime lt 32 then begin
>                 xyouts,50,70, "Beginning level "+strcompress(string(levelnum),/
> remove_all),alignment=.5
>                 xyouts,50,65, "This will last "$
>                 +strcompress(string(fix(levellength)/32),/remove_all)+"
> seconds",alignment=.5
>                 xyouts,50,60, "Enemies/sec= "+strcompress(string(diffnum*
> (32.0/100.0)),/remove_all),alignment=.5
>         endif
>
> ;DRAW USER...
>         cursor,xpos,ypos,/nowait
>         ;CHECK IF USER OUT OF RANGE.
>         IF xpos lt usersizex then xpos=usersizex
>         IF xpos gt 100-usersizex then xpos=100.-usersizex
>         IF ypos lt usersizey then ypos=usersizey
>         IF ypos gt 100.-usersizey then ypos=100.-usersizey
>         oplot,[xpos-usersizex,xpos-usersizex,xpos+usersizex,xpos
> +usersizex,xpos-usersizex],$
>               [ypos-usersizey,ypos+usersizey,ypos+usersizey,ypos-
> usersizey,ypos-usersizey],linestyle=0
>
> ;DRAW ENEMIES...
>         index=WHERE(Tenemytim ge 1)
>         check=size(index)
>         if check[0] ne 0 then begin
>         oplot,Xenemypos[index],Yenemypos[index],psym=enemypsym
>         endif
>
> ;CHECK FOR PAUSE...
>         input=get_kbrd(0)
>         if input ne "" then thekey=input
>         if thekey eq '.' then goto,hax
>         if thekey ne 'string' then begin
>                 if thekey ne 'p' then begin
>                         print, "EXITING."
>                         plot,indgen(100),indgen(100)
>                         goto, theend
>                         endif
>                 print,'paused.. enter to continue, or type exit to exit.'
>                 read,ans
>                 if ans eq 'exit' then goto, theend
>                 thekey='string'
>                 endif
>
> ;CHECK FOR HIT...
>         if thekey eq '.' then goto,hax
>         hittest=WHERE((Xenemypos gt xpos-usersizex and Xenemypos lt xpos
> +usersizex) $
>                   and (Yenemypos gt ypos-usersizey and Yenemypos lt
> ypos+usersizey))
>         check=size(hittest)
>         if check[0] ne 0 then begin
>                 oplot,indgen(100),indgen(100),linestyle=difficulty
>                 print, "HIT!"
>                 PRINT, "YOU FAIL..."
>                 print, "Total score = ",fix(((levelnum+float(thetime)/float
> (levellength))*1000.-1000.)*difficulty)
>                 goto, theend
>         endif
>         hax:
>
> ;WAIT
>         wait,0.03125;32 fps
>
> ;RECALCULATE ENEMY LOCATION...
>         index=where(Tenemytim ge 1)
>         check=size(index)
>         if check[0] ne 0 then begin
>                 Xenemypos[index]=Xenemypos[index]
>                 Yenemypos[index]=Yenemypos[index]+Yenemyvel[index]-difficult y/3.0
>                 Tenemytim[index]=Tenemytim[index]+1
>         endif
>
> ;GENERATE NEW ENEMIES...
>         rn1=FIX(levelnum*difficulty*RANDOMU(S, 1))
>         while rn1 le levelnum*difficulty do begin
>                 enemynum++
>                 if enemynum ge maxenemies-1 then enemynum=0
>                 newvel=  fix(RANDOMU(S, 1)*32.0)/32.0+levelnum/maxnumlevels
>                 newpos=FIX(100*RANDOMU(S, 1))
>                 Tenemytim[enemynum]=1
>                 Xenemypos[enemynum]=newpos
>                 Yenemypos[enemynum]=100.0
>                 Yenemyvel[enemynum]=newvel*(-1)
>         rn1++
>         endwhile
>
> ;DELETE OLD ENEMIES
>         del=WHERE(Yenemypos gt 101 or Yenemypos lt -1)
>         check=size(del)
>         if check[0] ne 0 then begin
>                 Xenemypos[del]=0.0
>                 yenemypos[del]=0.0
>                 yenemyvel[del]=0.0
>                 Tenemytim[del]=0
>         endif
>
> ;LEVEL END
> endfor
>
> ;END OF LEVEL CHANGES
>         usersizex=usersizex+.1*difficulty
>         usersizey=usersizey+.1*difficulty
>         levelnum++
> endwhile
>
> print, "you win!"
> theend:
> print, "END OF PROGRAM."
> end
Re: AVALANCHE.PRO .... games in IDL FTW [message #69066 is a reply to message #69065] Mon, 14 December 2009 15:57 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Dec 14, 8:30 am, Vince Hradil <vincehra...@gmail.com> wrote:
> On Dec 14, 7:37 am, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>> munka writes:
>>> So,  I don't really have any questions.  I'm just here to share the
>>> wealth and show y'all this program.  
>
>>> Also, all this was possible because of Dr. Fanning's amazingly helpful
>>> website ;)
>
>> Gosh, I feel like a proud grandpa. But I didn't realize I would
>> feel just as ignorant and confused as that day, long ago, when
>> I held my firstborn for the first time, trying to make out which
>> end was up, and wholly unprepared and surprised by the small
>> geyser that suddenly erupted. "Does this thing come with
>> instructions!?", I wondered both then and now.
>
>> But no, you are just suppose to figure things out as you
>> go along. I'm not sure it's the *best* system the Universe
>> could have evolved, but I guess it works, more or less. :-)
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> http://xkcd.com/674/

DL link... https://tigerbytes2.lsu.edu:443/users/wfreem2/web/avalanche. pro
Re: AVALANCHE.PRO .... games in IDL FTW [message #69088 is a reply to message #69066] Tue, 22 December 2009 05:33 Go to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
> Well then whats the best way to kill the program when you get hit?

RETURN

> see? I'm not that bad... Also, is there a better way to make the
> program bomb (in case of some error) without making it 'go to' the
> end?

look at "Error Handling" in the help file

Jean
Re: AVALANCHE.PRO .... games in IDL FTW [message #69091 is a reply to message #69062] Mon, 21 December 2009 14:42 Go to previous message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Dec 15, 7:46 am, David Fanning <n...@dfanning.com> wrote:
> Reimar Bauer writes:
>> you should kill that chapter where you explain "goto"
>
> You know, it's kinda like when you are trying to get
> your teenagers to pick up a book now and then. You
> can't be too fussy about what gets them excited.
> It's the passion that pushes them along.
>
> I predict we will see more programs by this young
> man with fewer GoTos, and maybe even some instructions,
> soon. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Well then whats the best way to kill the program when you get hit? I
use the 'goto, theend' line of code in almost all of my programs


My classmate sent me this. He added the option to remove stars, which
is good, but he used a goto loops instead of a while loop.....



choice2=0
print,'Enter 1 to remove data points or 2 to skip:'
read,choice2
if choice2 eq 1 then goto,datarm
if choice2 eq 2 then goto,plot
if choice2 ne 1 && choice2 ne 2 then goto,theend

datarm:
removestars,dataR,dataV,dataB,6 ;LAST NUMBER IS raduis SIZE

choice3=0
print,'Enter 1 to remove more points or 2 to plot:'
read,choice3
if choice3 eq 1 then goto,datarm
if choice3 eq 2 then goto,plot
if choice3 ne 1 && choice3 ne 2 then goto,theend

plot:
plot,dataR


-------------------
And so i fixed it and sent it back...

ans = 'str'
print, "Remove Stars? y/n (default is n)"
read, ans
while ans eq 'y' do begin
device, decomposed=0
removestars,dataR,dataV,dataB,6 ;LAST NUMBER IS raduis SIZE
print , "Remove Stars? y/n (deafult is n)"
read , ans
endwhile





see? I'm not that bad... Also, is there a better way to make the
program bomb (in case of some error) without making it 'go to' the
end?

~Bill
PS. I actually didn't read the chapter on goto.
PPS. https://tigerbytes2.lsu.edu:443/users/wfreem2/web/test5.pro if
you already haven't... just mouse over the colored circles and avoid
the neutrinos.
Re: AVALANCHE.PRO .... games in IDL FTW [message #69123 is a reply to message #69066] Mon, 14 December 2009 06:30 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 14, 7:37 am, David Fanning <n...@dfanning.com> wrote:
> munka writes:
>> So,  I don't really have any questions.  I'm just here to share the
>> wealth and show y'all this program.  
>
>> Also, all this was possible because of Dr. Fanning's amazingly helpful
>> website ;)
>
> Gosh, I feel like a proud grandpa. But I didn't realize I would
> feel just as ignorant and confused as that day, long ago, when
> I held my firstborn for the first time, trying to make out which
> end was up, and wholly unprepared and surprised by the small
> geyser that suddenly erupted. "Does this thing come with
> instructions!?", I wondered both then and now.
>
> But no, you are just suppose to figure things out as you
> go along. I'm not sure it's the *best* system the Universe
> could have evolved, but I guess it works, more or less. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

http://xkcd.com/674/
Re: AVALANCHE.PRO .... games in IDL FTW [message #69125 is a reply to message #69123] Mon, 14 December 2009 05:37 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
munka writes:

> So, I don't really have any questions. I'm just here to share the
> wealth and show y'all this program.
>
> Also, all this was possible because of Dr. Fanning's amazingly helpful
> website ;)

Gosh, I feel like a proud grandpa. But I didn't realize I would
feel just as ignorant and confused as that day, long ago, when
I held my firstborn for the first time, trying to make out which
end was up, and wholly unprepared and surprised by the small
geyser that suddenly erupted. "Does this thing come with
instructions!?", I wondered both then and now.

But no, you are just suppose to figure things out as you
go along. I'm not sure it's the *best* system the Universe
could have evolved, but I guess it works, more or less. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: AVALANCHE.PRO .... games in IDL FTW [message #69129 is a reply to message #69125] Mon, 14 December 2009 00:18 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 14 Dez., 09:04, munka <mynameismu...@gmail.com> wrote:
> If you have ever needed to plot a whole bunch of things, you may of
> put a plot command in a for/while loop.  If you forgot to put
> something like wait,1 in your loop, you might have gotten something
> that looks like an animation almost.  I noticed this, and this
> "animation" in combination with the cursor function, you can make some
> sweet games... like avalanche. I got bored and wrote out this game in
> IDL (It's less than 200 lines!)
>
> I realize there is some crappy programming going on in this program,
> but oh well!  I've only known of IDL (or programming for that matter)
> for less than 3 years. (I'm an undergrad in physics/astronomy)
>
> Stuff like
> for i=0,maxenemies-1,1 do Xenemypos[i]=0.0
> instead of:
> Xenemypos=replicate(0.0,maxenemies)
> and the use of goto statements......... :O
> But don't worry about that....
>
> So,  I don't really have any questions.  I'm just here to share the
> wealth and show y'all this program.  I have a better game written with
> the same... "engine"...... but I've been adding comments to it,
> because it is a bit more complicated. I'll post that on here a
> probably sometime later this week. If you have questions or comments,
> feel free to email me at billfreeman44 [at] yahoo.com. I don't check
> my gmail very often.
>
> Also, all this was possible because of Dr. Fanning's amazingly helpful
> website ;)
>
> Enjoy!
> ~Bill
>
> (and if you look closely, you might even be able to cheat! :D  )
>
> pro avalanche
> ;VARIABLES
> difficulty=1 ;set by user in game (see into game screen)
> levelnum=1
> maxnumlevels=50
> usersizex=.5
> usersizey=.5
> maxenemies=1001
> enemypsym=2
>
> thetime=long(0)
> thekey='string'
> ans='string'
> Xenemypos=fltarr(maxenemies)
> Yenemypos=fltarr(maxenemies)
> Yenemyvel=fltarr(maxenemies)
> Tenemytim=fltarr(maxenemies)
> for i=0,maxenemies-1,1 do Xenemypos[i]=0.0
> for i=0,maxenemies-1,1 do Yenemypos[i]=0.0
> for i=0,maxenemies-1,1 do Yenemyvel[i]=1./10*RANDOMU(S, 1)
> for i=0,maxenemies-1,1 do Tenemytim[i]=0.0
> enemynum=0
> thetime=long(1)
>
> ;INTRO GAME SCREEN
>         plot,[0,100],[0,100],/nodata
>         xyouts,50,60, "AVALANCHE",alignment=.5,charsize=3.5
>         xyouts,50,50, "click a difficulty to begin",alignment=.5,charsize=2.5
>         xyouts,50,45, "hit p to pause (while playing)",alignment=.
> 5,charsize=2
>         xyouts,50,40, "hit any key to EXIT (while playing)",alignment=.
> 5,charsize=1
>         xyouts,25,25, "EASY",alignment=.5,charsize=1
>         xyouts,50,25, "MEDIUM",alignment=.5,charsize=1
>         xyouts,75,25, "HARD",alignment=.5,charsize=1
>
> ;GET DIFFICULTY
>         cursor,xpos,ypos,/up
>         if abs(xpos-25) lt abs(xpos-50) and abs(xpos-25) lt abs(xpos-75) then
> difficulty=1
>         if abs(xpos-50) lt abs(xpos-25) and abs(xpos-50) lt abs(xpos-75) then
> difficulty=2
>         if abs(xpos-75) lt abs(xpos-25) and abs(xpos-75) lt abs(xpos-50) then
> difficulty=3
>         plot,[0,100],[0,100],/nodata
>         if difficulty eq 1 then xyouts,50,50, "EASY",charsize=2
>         if difficulty eq 2 then xyouts,50,50, "MEDIUM",charsize=2
>         if difficulty eq 3 then xyouts,50,50, "HARD",charsize=2
>         WAIT,1
>
> while levelnum lt maxnumlevels do begin
>
> levelstart:
> ;LEVEL VARIABLES...
>         levellength=long(320);length of level in frames
>         diffnum=100.;fix(35+levelnum*1.5+difficulty*2);percent chance of
> enemy spawn
>
> ;LEVEL BEGIN
>         for thetime=long(0),long(levellength),1 do begin
>
> ;DRAW LEVEL
>         plot,[0,100],[0,100],/nodata,xminor=1,yminor=1,xmargin=[0,0] ,ymargin=
> [0,0],ticklen=0,xticks=1,yticks=1
>
> ;DRAW SCORE
>         xyouts,2,98, "score = "+strcompress(string(fix(((levelnum+float
> (thetime)/float(levellength))*1000.-1000.)*difficulty)))
>
> ;INTRO TO EACH LEVEL..
>         if thetime lt 32 then begin
>                 xyouts,50,70, "Beginning level "+strcompress(string(levelnum),/
> remove_all),alignment=.5
>                 xyouts,50,65, "This will last "$
>                 +strcompress(string(fix(levellength)/32),/remove_all)+"
> seconds",alignment=.5
>                 xyouts,50,60, "Enemies/sec= "+strcompress(string(diffnum*
> (32.0/100.0)),/remove_all),alignment=.5
>         endif
>
> ;DRAW USER...
>         cursor,xpos,ypos,/nowait
>         ;CHECK IF USER OUT OF RANGE.
>         IF xpos lt usersizex then xpos=usersizex
>         IF xpos gt 100-usersizex then xpos=100.-usersizex
>         IF ypos lt usersizey then ypos=usersizey
>         IF ypos gt 100.-usersizey then ypos=100.-usersizey
>         oplot,[xpos-usersizex,xpos-usersizex,xpos+usersizex,xpos
> +usersizex,xpos-usersizex],$
>               [ypos-usersizey,ypos+usersizey,ypos+usersizey,ypos-
> usersizey,ypos-usersizey],linestyle=0
>
> ;DRAW ENEMIES...
>         index=WHERE(Tenemytim ge 1)
>         check=size(index)
>         if check[0] ne 0 then begin
>         oplot,Xenemypos[index],Yenemypos[index],psym=enemypsym
>         endif
>
> ;CHECK FOR PAUSE...
>         input=get_kbrd(0)
>         if input ne "" then thekey=input
>         if thekey eq '.' then goto,hax
>         if thekey ne 'string' then begin
>                 if thekey ne 'p' then begin
>                         print, "EXITING."
>                         plot,indgen(100),indgen(100)
>                         goto, theend
>                         endif
>                 print,'paused.. enter to continue, or type exit to exit.'
>                 read,ans
>                 if ans eq 'exit' then goto, theend
>                 thekey='string'
>                 endif
>
> ;CHECK FOR HIT...
>         if thekey eq '.' then goto,hax
>         hittest=WHERE((Xenemypos gt xpos-usersizex and Xenemypos lt xpos
> +usersizex) $
>                   and (Yenemypos gt ypos-usersizey and Yenemypos lt
> ypos+usersizey))
>         check=size(hittest)
>         if check[0] ne 0 then begin
>                 oplot,indgen(100),indgen(100),linestyle=difficulty
>                 print, "HIT!"
>                 PRINT, "YOU FAIL..."
>                 print, "Total score = ",fix(((levelnum+float(thetime)/float
> (levellength))*1000.-1000.)*difficulty)
>                 goto, theend
>         endif
>         hax:
>
> ;WAIT
>         wait,0.03125;32 fps
>
> ;RECALCULATE ENEMY LOCATION...
>         index=where(Tenemytim ge 1)
>         check=size(index)
>         if check[0] ne 0 then begin
>                 Xenemypos[index]=Xenemypos[index]
>                 Yenemypos[index]=Yenemypos[index]+Yenemyvel[index]-difficult y/3.0
>                 Tenemytim[index]=Tenemytim[index]+1
>         endif
>
> ;GENERATE NEW ENEMIES...
>         rn1=FIX(levelnum*difficulty*RANDOMU(S, 1))
>         while rn1 le levelnum*difficulty do begin
>                 enemynum++
>                 if enemynum ge maxenemies-1 then enemynum=0
>                 newvel=  fix(RANDOMU(S, 1)*32.0)/32.0+levelnum/maxnumlevels
>                 newpos=FIX(100*RANDOMU(S, 1))
>                 Tenemytim[enemynum]=1
>                 Xenemypos[enemynum]=newpos
>                 Yenemypos[enemynum]=100.0
>                 Yenemyvel[enemynum]=newvel*(-1)
>         rn1++
>         endwhile
>
> ;DELETE OLD ENEMIES
>         del=WHERE(Yenemypos gt 101 or Yenemypos lt -1)
>         check=size(del)
>         if check[0] ne 0 then begin
>                 Xenemypos[del]=0.0
>                 yenemypos[del]=0.0
>                 yenemyvel[del]=0.0
>                 Tenemytim[del]=0
>         endif
>
> ;LEVEL END
> endfor
>
> ;END OF LEVEL CHANGES
>         usersizex=usersizex+.1*difficulty
>         usersizey=usersizey+.1*difficulty
>         levelnum++
> endwhile
>
> print, "you win!"
> theend:
> print, "END OF PROGRAM."
> end

Funny!!!! Maybe you have also time to give those items some color and
maybe you make in the next step an "ultimate" gamepack with nibbles,
pong and so on :) How about Quake? :)

Indeed - Very funny.

Regards

CR
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: all membars comming here an super girls stils
Next Topic: line generalization

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:35:46 PDT 2025

Total time taken to generate the page: 0.00725 seconds