I wanted to create a Calcuzap (simplifed) type game as a fun project after getting an idea of how ice works. I wanted to store the data in a sort of list as that’s all I know from basic using CopyData(L1,3,1,10,10,9999) where the 1 represents an alien type of one, 10 and 10 are the coords of the alien, and 9999 signifes the end of the list. I wrote some functions to go through, draw each alien if I added more to the list, and update their positions. This was very slow. I saw the Seek command and I’m trying to figure out how to use it and memory allocation to add ingane objects. I’m not entirely sure how to explain this but I hope I got close. Any hep appreciated Smile
bikmin wrote:
I wanted to create a Calcuzap (simplifed) type game as a fun project after getting an idea of how ice works. I wanted to store the data in a sort of list as that’s all I know from basic using CopyData(L1,3,1,10,10,9999) where the 1 represents an alien type of one, 10 and 10 are the coords of the alien, and 9999 signifes the end of the list. I wrote some functions to go through, draw each alien if I added more to the list, and update their positions. This was very slow. I saw the Seek command and I’m trying to figure out how to use it and memory allocation to add ingane objects. I’m not entirely sure how to explain this but I hope I got close. Any hep appreciated Smile


Try this:

Code:

Copy(L1,Data(3,3,1,10,10,9999),15

This code will copy the 5, 3b numbers to L1
(15 bytes in total)
The 3 at the beginning of "Data(" is the number of bytes to use per number.

To access each number, you'll need to multiply the index by 3 (or whatever you decide to put at the start of "Data(" )

Code:

L1(INDEX*3->N

^ this code will work in ICE, but the following is better:

Code:

{L1+INDEX*3->N

^ this code gets 3 bytes from the memory adress (which is also a 3b number) L1+INDEX*3
NOTE: the highest number possible in ICE is 16777215
If you don't need that high of a number, then try a 1b or 2b number (maximum numbers: 255 and 65535, respectively)

Code:

*{L1+INDEX->ONE
**{L1+INDEX->TWO

Hope this helps, if you have any more questions don't hesitate to post them here Smile

P.S. You got pretty darn close for having just begun programming in ICE Razz
Thanks for the reply! My main issue is on how memory works in ICE, though. The code I had worked. The main problem is simply that I have no idea how to allocate memory in ICE and that’s the only memory related command I know. My fault - my question really should be “what’s a good way to create ingame objects like aliens that can be added or removed as necessary as the game goes on?”
beckadamtheinventor wrote:
bikmin wrote:
I wanted to create a Calcuzap (simplifed) type game as a fun project after getting an idea of how ice works. I wanted to store the data in a sort of list as that’s all I know from basic using CopyData(L1,3,1,10,10,9999) where the 1 represents an alien type of one, 10 and 10 are the coords of the alien, and 9999 signifes the end of the list. I wrote some functions to go through, draw each alien if I added more to the list, and update their positions. This was very slow. I saw the Seek command and I’m trying to figure out how to use it and memory allocation to add ingane objects. I’m not entirely sure how to explain this but I hope I got close. Any hep appreciated Smile


Try this:

Code:

Copy(L1,Data(3,3,1,10,10,9999),15

This code will copy the 5, 3b numbers to L1
(15 bytes in total)
The 3 at the beginning of "Data(" is the number of bytes to use per number.

To access each number, you'll need to multiply the index by 3 (or whatever you decide to put at the start of "Data(" )

Code:

L1(INDEX*3->N

^ this code will work in ICE, but the following is better:

Code:

{L1+INDEX*3->N

^ this code gets 3 bytes from the memory adress (which is also a 3b number) L1+INDEX*3
NOTE: the highest number possible in ICE is 16777215
If you don't need that high of a number, then try a 1b or 2b number (maximum numbers: 255 and 65535, respectively)

Code:

*{L1+INDEX->ONE
**{L1+INDEX->TWO

Hope this helps, if you have any more questions don't hesitate to post them here Smile

P.S. You got pretty darn close for having just begun programming in ICE Razz

Also, a 2byte number would work better, Thanks for the tip!
  
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 UTC - 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