Omnimaga
Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: Link on September 07, 2012, 09:29:14 pm
-
So, I understand grey-scale, and physics and so on, So I decided to make some sort of simple game. Except I don't get how to make a sprite move around using getkey or whatever, and still not pause the actual gray-scale updating? Can someone tell me how, to say make a small gray-scale box move around the screen? Just need an idea for the loop structure, that's all.
-
simple.
Repeat getKey(15) //make sure the program quits when you press {Clear}
ClrDrawrr
your greyscale sprite goes here
DispGraphrr
your sprite movement control goes here
End
I know that it's not optimized, but it'll do. :D
-
simple.
Repeat getKey(15) //make sure the program quits when you press {Clear}
ClrDrawrr
your greyscale sprite goes here
DispGraphrr
your sprite movement control goes here
End
I know that it's not optimized, but it'll do. :D
Okay, thanks, and one more question, why is most sprite movement multiplied by 256? it it for some specific reason?
-
I'm not sure but I think they were usually related to gravity or something.
-
Yes, *256 inflation is used for physics, which allows the player to move at 1/256 of a pixel at a time.
-
Yes, *256 inflation is used for physics, which allows the player to move at 1/256 of a pixel at a time.
How does that work, say you have to move 2, then *256, it becomes 512, doesn't that go over the limit of 96 px?
-
No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. :)
-
No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. :)
K, and this is used in pretty much all physics right?
-
No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. :)
K, and this is used in pretty much all physics right?
It's certainly the most optimized number for position inflation. In fact, since Axe is big-endian, instead of doing VAR/256, you can do {°VAR+1}. This method also has a lot of uses outside of physics, too.
-
No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. :)
K, and this is used in pretty much all physics right?
It's certainly the most optimized number for position inflation. In fact, since Axe is big-endian, instead of doing VAR/256, you can do {°VAR+1}. This method also has a lot of uses outside of physics, too.
It's actually little-endian, but yes, that is the correct method.
-
Wait, if you use +1 to access the high byte, why isn't it big endian? :P I've been deceived D:
-
Big endian means that the highest byte comes first. Little endian means the lowest byte comes first.
-
Ugh, I got big endian and little endian mixed up XD Big endian sounds like the big byte should be at the end, that's my justification.
/me runs
-
Hmm, well I tried this according to what yeong said: but it isn't working? Whats wrong >.>
:.A
:AsmComp(SPEEDKEY)
:[7E81BD817E18183C]→Pic1
:[7EFFC3FF7E18183C]→Pic2
:ClrDraw{^r}{^r}
:0→X→Y
:While 1
:Zoom Out→A
:Pt-Off(X/256,Y/256,Pic1)
:Pt-Off(X/256,Y/256,Pic2){^r}
:DispGraphClrDraw{^r}{^r}
:If A=1
:Y--
:End
:If A=2
:X--
:End
:If A=3
:X++
:End
:If A=4
:Y++
:End
:EndIf getKey(15)
-
Hmm, well I tried this according to what yeong said: but it isn't working? Whats wrong >.>
:.A
:AsmComp(SPEEDKEY)
:[7E81BD817E18183C]→Pic1
:[7EFFC3FF7E18183C]→Pic2
:ClrDraw{^r}{^r}
:0→X→Y
:While 1
:Zoom Out→A
:Pt-Off(X/256,Y/256,Pic1)
:Pt-Off(X/256,Y/256,Pic2){^r}
:DispGraphClrDraw{^r}{^r}
:If A=1
:Y--
:End
:If A=2
:X--
:End
:If A=3
:X++
:End
:If A=4
:Y++
:End
:EndIf getKey(15)
I'm assuming that when you press the enter keys, the sprite doesn't appear to move. That's totally normal, because you're only subtracting or adding one to each variable, and it takes 256 such adds or subtracts to move one pixel. To mitigate this, you might try Y-25->Y instead of Y-- and see if that makes a difference.
-
Thanks, that made it work, much smoother and visible too.