Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I have no idea what is the best way to have "bullets" in an ice game. The only way I can imagine is by having a terrible time doing it like this (where when a bullet is fired it's corresponding variable is set to 1)
Code:
If BulletOne=1
det(57,bullet,bulletonex,bulletoney)
End
If BulletTwo=1

etc. Bulletone and Bullettwo are variables for having multiple separate bullets onscreen. If you don't understand my ramblings then ignore them, I just want to know how, like CALCUZAP, implements bullets, into their code.
They probably keep an array that contains each bullets X,Y, ∆X, and ∆Y. When a bullet is added, it is appended to the end of the array. When it is removed, swap it with the last element, then reduce the array size by one element. When you want to advance each bullet, you erase it (if necessary on your application), add each bullet's ∆X and ∆Y to its X and Y, then redraw.

This is the standard idea, as for how to implement it in ICE, not sure (I don't have a CE :/ ).
In ICE, you would want to use a list in order to store elements. Here's the documentation page for lists.

If you wanted to store the position and speed of each bullet, that would be 4 3-byte values or 12 bytes for each bullet. So you could do L1(12*N+0) to get/store the X coord of the Nth bullet, L1(12*N+3) for the y-coord, and L1(12*N+6) and L1(12*N+9) for the X and Y velocity of then Nth bullet. If all bullets are moving at the same speed/direction you could use 6 instead of 12 and only use the positions of each bullet.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement