Thread: Mini-Games
View Single Post
  #30  
Old 08-23-2001, 05:59 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
In original asteroids, I think you only had one missle at a time...so it's easy, xshot, yshot, xshotspeed, yshotspeed. If you want more than one missle, setarray shots,4*shotsmax; and for(this.i=0;this.i<(shotsmax/4);this.i++){ if(shots[this.i*4] in |x-1,x+1| && shots[(this.i*4)+1] in |y-1,y+1|){// hit something} shots[this.i*4]+=shots[(this.i*4)+2]; shots[(this.i*4)+1]+=shots[(this.i*4)+3]; }

Hope that confused the crud out of you. I'll now refuse to elaborate. ^_~

Naw, not that cruel. Here's your array:
shots=[32,32,-0.5,0.75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
the first 2 numbers of each set of 4 is the x and y of the shot, in this case, shot 0 is at 32, 32. The third number is the x difference, every time it loops it moves left 0.5. The fourth is the y difference, every time it loops it moves down 0.75. It works, it's just a pain in the neck to write the for loop for finding a free slot, attacking, hitting something, etc.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote