Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: obon7 on November 27, 2011, 11:35:13 pm

Title: ANother noob qusestion
Post by: obon7 on November 27, 2011, 11:35:13 pm
Can anybody explain to me what a sprite is and how do you use/create them THX. :banghead:
Title: Re: ANother noob qusestion
Post by: epic7 on November 27, 2011, 11:43:34 pm
Sprite is an 8x8 object used in games

A sprite would be stored like
[sprite data]->Pic1
Or pic2, pic3 etc

Inside the [], the sprite is in hexadecimal.
For example,
[FFFFFFFFFFFFFFFF]->Pic1
(16 Fs) would make a block that is all black

To make the hexadecimals, I use the program included in the axe folder that is with the app
 It is called HEXPIC , I believe.

To use them, once you have stored it, like in pic1

Do
Pt-On(X coord, Y coord,Pic1)

(and don't forget to DispGraph ;) )
 
Title: Re: ANother noob qusestion
Post by: obon7 on November 27, 2011, 11:56:11 pm
THX
Title: Re: ANother noob qusestion
Post by: saintrunner on November 28, 2011, 05:14:02 pm
And if you are making the sprite move, I suggest using
Pt-change(X,Y,pic#)
dispgraph
Pt-change(X,Y,pic#)

pt change simply changes the point from on to off, or vis versa. And pt-on just turns it on, or pt-off which is off. :)
Title: Re: ANother noob qusestion
Post by: epic7 on November 28, 2011, 05:16:27 pm
Lol, I've never used that before :P
I just do pt-On

and always have a dispgraphclrdraw

I tried pt-off once but it screwed up ???
Title: Re: ANother noob qusestion
Post by: parserp on November 28, 2011, 05:19:07 pm
Lol, I've never used that before :P
I just do pt-On

and always have a dispgraphclrdraw

I tried pt-off once but it screwed up ???
yeah me too, I save everything but the moving thing to the back buffer and use RecallPic every Frame.
Title: Re: ANother noob qusestion
Post by: Happybobjr on November 28, 2011, 05:19:47 pm
point off just makes the 8 by 8 white, then draws the black part to the screen :P
Title: Re: ANother noob qusestion
Post by: epic7 on November 28, 2011, 05:26:21 pm
Lol, I've never used that before :P
I just do pt-On

and always have a dispgraphclrdraw

I tried pt-off once but it screwed up ???
yeah me too, I save everything but the moving thing to the back buffer and use RecallPic every Frame.

Ooh, good idea.

Wait, how? :P
Title: Re: ANother noob qusestion
Post by: parserp on November 28, 2011, 05:31:27 pm
Lol, I've never used that before :P
I just do pt-On

and always have a dispgraphclrdraw

I tried pt-off once but it screwed up ???
yeah me too, I save everything but the moving thing to the back buffer and use RecallPic every Frame.

Ooh, good idea.

Wait, how? :P
I usually use an appvar- do this:
Code: [Select]
:GetCalc("appvLELVEL",Y0
:Copy(Y0,L3,768
:Repeat GetKey(15)
:RecallPic
:draw player and stuff
:DispgraphClrdraw
:movement stuff
:End
Title: Re: ANother noob qusestion
Post by: saintrunner on November 28, 2011, 06:11:34 pm
Wait, how do you make appvars?
Title: Re: ANother noob qusestion
Post by: parserp on November 28, 2011, 06:15:44 pm
Wait, how do you make appvars?
:GetCalc("appvNameOfAppvar",#OfBytes)->Pointer
then to store stuff into it:
Copy(StuffToCopy,Pointer,#OfBytes)

...such as:
:GetCalc("appvBLAH",768)->A //apvar created and stored into A with 768 bytes (enough for a picture)
:Copy(L6,A,768) //copies buffer into appvar (just like an OS pic)
Title: Re: ANother noob qusestion
Post by: saintrunner on November 28, 2011, 06:17:53 pm
so is L6 a list? How does that part work, How do I put stuff as the list?
Title: Re: ANother noob qusestion
Post by: parserp on November 28, 2011, 06:20:10 pm
so is L6 a list? How does that part work, How do I put stuff as the list?
L6 isn't a "list", such as the lists in the OS, but they are Pointers.
L6 happens to be where the data for the buffer is stored. (buffer: aka: graph screen ;))
when you use the command dispgraph, it evaluates the data in L6 and draws points accordingly.
Title: Re: ANother noob qusestion
Post by: saintrunner on November 28, 2011, 06:22:43 pm
so could I store a main loop as an appvar? for example, could I have my program set up as this:

in the program it has the menu info, then if you press level 1 it opens appvLEVEL1 which has all of the loop and stuff for that level, ? This is, to store level 1 as an appvar instead of another program.
Title: Re: ANother noob qusestion
Post by: parserp on November 28, 2011, 06:25:26 pm
so could I store a main loop as an appvar? for example, could I have my program set up as this:

in the program it has the menu info, then if you press level 1 it opens appvLEVEL1 which has all of the loop and stuff for that level, ? This is, to store level 1 as an appvar instead of another program.
you can store data in an appvar, but as far as putting code in them, it doesn't work. I'm not sure why, but asm people say that a lot of stuff gets screwed up. (ask asm person for more info)
Title: Re: ANother noob qusestion
Post by: saintrunner on November 28, 2011, 06:30:55 pm
oh ok then :) thanks
Title: Re: ANother noob qusestion
Post by: LincolnB on November 28, 2011, 10:52:21 pm
*sniff* I'm so proud of you, parser, my star pupil. (my only pupil. and not really actually my pupil).

...methinks you may have used that appvar technique from my GPOS thread? ;) (it's totally fine, I'm just curious)
Title: Re: ANother noob qusestion
Post by: obon7 on November 28, 2011, 11:24:34 pm
quick question is storing something in appvars really the same as storing something in pic 1,pic2 etc., and if not what are the differences
 
Title: Re: ANother noob qusestion
Post by: Quigibo on December 02, 2011, 05:01:18 am
Assuming you're talking about the OS's Pic0-Pic9 and not an Axe pointer name, yes they are the same from a coding perspective.  To the OS, they are a little different though.  When the OS sees a Pic1 it assumes its a picture and will let you use all those BASIC commands on it.  When you use an appvar, the OS will not really let you do much to them and the only place you will see them is in the memory management screen.  Also, appvars will take up more room in RAM since they also have names which are up to 8 characters long.

But yeah, other than that, you can store data to anything and use it just the same: appvars, pics, strings, lists, even the OS vars.  But the best option for regular data is probably the appvar because its invisible to the end user and can't be deleted accidentally unlike a pic or string for instance which will get overridden constantly by BASIC programs.
Title: Re: ANother noob qusestion
Post by: parserp on December 02, 2011, 09:16:37 am
*sniff* I'm so proud of you, parser, my star pupil. (my only pupil. and not really actually my pupil).
lol
...methinks you may have used that appvar technique from my GPOS thread? ;) (it's totally fine, I'm just curious)
? can i have a link?
Title: Re: ANother noob qusestion
Post by: LincolnB on December 02, 2011, 05:11:54 pm
GPOS stands for Game Programming On Steroids, I'm assuming you didn't then ;)
Title: Re: ANother noob qusestion
Post by: C0deH4cker on December 02, 2011, 05:40:21 pm
I know that L6 is the main buffer (plotSScreen in asm), but i assume that it isnt the pointer to the graph screen data. How can i have an axe program (like graphjump or wormy in grammer) that can use the data from the graph screen?
Title: Re: ANother noob qusestion
Post by: Builderboy on December 02, 2011, 05:44:20 pm
What do you mean by graph screen?  L6 is indeed the pointer to the main buffer, where the graphscreen images are stored. 
Title: Re: ANother noob qusestion
Post by: C0deH4cker on December 02, 2011, 06:00:08 pm
like if from the homescreen you do a RecallPic or even just draw on the graph screen, when an axe program is run, it can use that data even without it being saved to a picture. Is this possible?
Title: Re: ANother noob qusestion
Post by: Builderboy on December 02, 2011, 06:07:39 pm
If the data is already on the graphscreen when the Axe program is run, the data will be stored in L6.
Title: Re: ANother noob qusestion
Post by: C0deH4cker on December 02, 2011, 06:08:12 pm
alright, ill try it.


Edit: it works, thanks!
In case youre wondering, im making a game similar to grammer's graphjump with axe. It is more advanced, however, with 8-directional shooting that will destroy walls and more easily controllable left/right/jumping. ill release a demo soon. atm, the player (a pixel) starts at (1,1), jumps 5 pixels up, and can shoot one bullet at a time (it has to hit something in order for you to shoot again). controls are:

left=left
right=right
up=jump
numpad shoots:

7    8    9
4    *    6
1    2    3

Still have to work out some bugs though, like if you hold down up and shoot straight down, you jump off of the bullet :P