Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on November 10, 2010, 07:38:15 am
-
Hello omnicommunity,
As most of you know, I am working on a side-scroller game. It is progressing nicely, but I have issues level creating.
I currently have this code:
0=>C
0=>A
A=time
C=Position in string of next object)
data(1,10)=>Str1 (when to occur)
data(1,52)=>Str2 (Where to occur (ypos)
Lbl1
If A={Str1+C}
{Str2+C}=>{L1+2+(2*{L1+0})} Ypos {L1+0}= how many objects now?
95=>{L1+1+(2*{L1+0})} Xpos
{L1+0}+1=>{L1+0} amount of objects +1
C+1=>C
End
(move object)
For(B,0,({L1+0}*2)
!If {L1+1+B}=0
Pt-Off({L1+1+B},{L1+2+B},[object]
Pt-Off(({L1+1+B}+1),({L1+2+B}),[same object]
{L1+1+B}-1=>{L1+1+B}
{L1+2+B}=>{L1+2+B} [included for optional vertical moving]
Pt-On({L1+1+B},{L1+2+B},[object]
End
If {L1+2+B}<3
(Now, I dont know how to let the objects dissapear)
Plz help me with the rest of the code... else I cant continue my project :(
Thanx,
aeTIos
P.S. Optimization is welcome too.
-
I probably can't help much but it might help others if you tell us what is happening and what it is supposed to do exactly.
-
the code is not complete, there is a part missing that:
-has to let the object being disappeared if x<3 so X=1,2
-it should make that the other objects stay displayed, and the data position of their data in L1 should be moved forward if a object disappears, such as
For(A,1,{L1+0}
{L1+1+A+2}=>{L1+1+A}
A+1=>A
End
But that doesnt work, then all objects disappear :(
If you know a solution, plz post the code
-
Is the goal to make the object invisible or to eliminate it entirely? If it's the former, then you could have a second array with values corresponding to each of the objects. Each element would have a 0 if visible and a 1 if invisible. You then simply erase the object once and flip the bit. Your display routine should then know to not display objects with a 1 bit.
-
It is goal to eliminate it
-
To move data around when its not just a byte or 16-bit entry, you have to use Copy(). I used this a lot in the starship example program for the lists of enemies and bullets. Basically the way I deleted an element in the array was to copy the last element over the current one and then shrink the size variable by 1.
I should probably write an array library for this to make it easier.
-
Arrays sound awesome for Axe. By the way, when Axioms get re-enabled, will they use the same format?
And aeTIos, yeah, use Copy(. It's a lot faster and smaller :)
-
kk, I'll try...
-
I tried using Copy(, but it didnt work...
attached a group with the source (SHIP,METEOR,SPIMPSRC) and the game. (lose)
METEOR is the program where the problem is located.
plz help,
aeTIos
-
The group is corrupted. What software do you use to create those files? Don't use Wabbitemu export function because it's buggy.
-
I used Wabbit, yes, but if I download and ungroup it, the files are *not* corrupted. maybe you should open it with Wabbit and export them then?
-
Hmm... Wabbitemu group support changed. It used to just ungroup stuff as you sent them, but now it doesn't anymore, and you absolutely have to send it to archive to get it to work. If sent to RAM it will not work.
And SourceCoder cannot open the file.
Anyway got it to work in the latest version of Wabbitemu. Send to archive, ungroup, done.
-
Hmm... Wabbitemu group support changed. It used to just ungroup stuff as you sent them, but now it doesn't anymore, and you absolutely have to send it to archive to get it to work. If sent to RAM it will not work.
And SourceCoder cannot open the file.
Anyway got it to work in the latest version of Wabbitemu. Send to archive, ungroup, done.
How you open files with SourceCoder, I thought it would only CREATE files???
-
Hmm... Wabbitemu group support changed. It used to just ungroup stuff as you sent them, but now it doesn't anymore, and you absolutely have to send it to archive to get it to work. If sent to RAM it will not work.
And SourceCoder cannot open the file.
Anyway got it to work in the latest version of Wabbitemu. Send to archive, ungroup, done.
How you open files with SourceCoder, I thought it would only CREATE files???
http://sc.cemetech.net/
There's an upload button ;)
You can also save, edit, and share projects (if you're logged in).
I used Wabbit, yes, but if I download and ungroup it, the files are *not* corrupted. maybe you should open it with Wabbit and export them then?
The export feature is broken right now. Any programs you export will be corrupted, so I'd advise against doing that...
Apparently BuckeyeDude's already fixed the issue, but he's found other bugs, so you'll have to wait for a new version.
-
I think SourceCoder can also convert images, now.
-
I think SourceCoder can also convert images, now.
Oh, yeah, that too. It's the same uploader. It converts an image file into a calc version, which you can view as .dbs, as hex (for Axe), and as Pic2.8xi.
-
*bump*
-
alright well.. i read through this topic but i still don't know what you're trying to do, besides create a level (which is too general).
-what's its height?
-what's its width?
-how many tiles are there?
-is this a level editor?
-does it need to smoothscroll, or can it scroll by tiles?
-are there any "special" tiles that correspond with each other?
or am i completely off base?
-
the code is not complete, there is a part missing that:
-has to let the object being disappeared if x<3 so X=1,2
-it should make that the other objects stay displayed, and the data position of their data in L1 should be moved forward if a object disappears, such as
For(A,1,{L1+0}
{L1+1+A+2}=>{L1+1+A}
A+1=>A
End
But that doesnt work, then all objects disappear :(
If you know a solution, plz post the code
Hmm, what's this line for?
{L1+1+A+2}=>{L1+1+A}
It doesn't seem to do anything... Unless that => is a STO→ symbol?
I'll test the code later.
-
Given how he used it again in the line "A+1=>A", I think he means the store arrow.
-
alright well.. i read through this topic but i still don't know what you're trying to do, besides create a level (which is too general).
-what's its height?
-what's its width?
-how many tiles are there?
-is this a level editor?
-does it need to smoothscroll, or can it scroll by tiles?
-are there any "special" tiles that correspond with each other?
or am i completely off base?
Its side-scrolling, so smooth, and there are no tiles, only objects and backgrounds
-
*bump*
anyone wanting to help me out ??? ???
-
aeTIos, all I've been able to draw from what you've said is that you want code to randomly generate levels for a sidescroller. I believe I speak for all of us when I say that this is too vague to understand what exactly you want. Despite how much we may want to help, we really can't help you until we have a better idea of what you want.
-
aeTIos, all I've been able to draw from what you've said is that you want code to randomly generate levels for a sidescroller. I believe I speak for all of us when I say that this is too vague to understand what exactly you want. Despite how much we may want to help, we really can't help you until we have a better idea of what you want.
okay, i'm sorry to all of you if I maybe sounded a little uncomprehensive.(sorry if that is spelled wrong)
what I exactly want to do is this:
put the level code in str1, like as {1} in str1 should be (for example) a meteor, etc. I tried it in the form "object-when to occur", then in str2 where to occur, in Y-position. then, i have the routine for the falling meteorite, else the code is not complete. then, there is a part of the code that i dont know how to code:
if X<3
For(A,0,10)
{L1+A+3}→{L1+A+1}
A+1→A
End
this code does not work, it is the reason I created this topic.
Copy( does not work as far I know.
I hope that now all is clear ??? ???
-
From what I can tell, that code will shift every other byte, starting at L1+3, backwards 2 bytes in memory. A total of 6 bytes of data will be moved. I may be wrong, but I'm guessing that this is not the effect you wanted to achieve?
Before:
Address: | L1 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +10 | +11 | +12 | +13 |
Data: | A | B | C | D | E | F | G | H | I | J | K | L | M | N |
After (changes in bold):
Address: | L1 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +10 | +11 | +12 | +13 |
Data: | A | D | C | F | E | H | G | J | I | L | K | N | M | N |
-
this is still difficult to grasp. does this description summarize what you want?
a string of bytes which each correspond to a sprite.
there is another string of bytes corresponding with the first string of bytes. this string says "after X pixels scrolled, draw the object on the screen"
there is a third string telling the routine where to place the sprite.
for example, considering 1 is a meteor sprite and 2 is a tree sprite:
Data(1,2)->Str1 // what object 1 = meteor, 2 = tree
Data(50,30)->Str2 // every 50 pixels scrolled, display a meteor. every 30 pixels scrolled, display a tree.
Data(0,45)->Str3 // when you display a meteor, display it at (88,0). when you display a tree, display it at (88,45)
am i right?
if so, here's some code assuming the above declarations:
[meteor_sprite_hex]->Pic1
[tree_sprite_hex]
Repeat getKey(15)
...
For(Z,0,length(Str1)-1
!If pixelsScrolled^{Str2+Z}
Pt-Off(88,{Str3+Z},{Str1+Z}-1*8+Pic1
End
End
...
End
edit: and runer, i know it can be heavily optimized. but i just tried to make an example obvious to what i am doing
-
From what I can tell, that code will shift every other byte, starting at L1+3, backwards 2 bytes in memory. A total of 6 bytes of data will be moved. I may be wrong, but I'm guessing that this is not the effect you wanted to achieve?
Before:
Address: | L1 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +10 | +11 | +12 | +13 |
Data: | A | B | C | D | E | F | G | H | I | J | K | L | M | N |
After (changes in bold):
Address: | L1 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +10 | +11 | +12 | +13 |
Data: | A | D | C | F | E | H | G | J | I | L | K | N | M | N |
I want every byte starting at {L1+3} 2 bytes to the beginning of L1 moved. so {L1+3}->{L1+1} and so on
And nemo, no, the objects should be moving.
thanks already guys, plz hold on
-
how bout this?
[meteor_sprite_hex]->Pic1
[tree_sprite_hex]
0->C
Repeat getKey(15)
...
C+1->C
For(Z,0,length(Str1)-1
!If pixelsScrolled^{Str2+Z}
Pt-Off(88,sin(C)//4+{Str3+Z},{Str1+Z}-1*8+Pic1
End
End
...
End
[/code