Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LemonDrop

Pages: 1 [2]
16
Axe / Re: Problem with shooter code
« on: August 04, 2013, 10:19:44 pm »
So I decided that a 2x logical grid would allow for enough precision and I want to make it 10x the size of the screen, but I am not sure about how to do some stuff. Firstly I decided to make the x and y speeds into signed numbers just for convenience, but I do not know how to make a number signed and dont know if it works with normal math like Adding a signed number to a non signed one (e.g. 2+(-1) equaling 1 like it should). Also to make the logical grid that big, I would have to use 16 bit numbers which I know take up 2 bytes but I dont know how to create them and again dont know if they work with non 16 bit numbers (final product being the signed x and y speeds are added to 16 bit x and y positions, which are then divided by 10 and displayed to the screen). Sorry for asking so many questions but theres not much stuff about axe I could find on the internet.

17
Axe / Re: Problem with shooter code
« on: August 04, 2013, 05:19:53 pm »
a simpler, faster method to manage this would be to just make your playing area be larger than the actual screen resolution by some factor of two. then you can accomplish this with only a single slope calculation when the bullet is initially fired and without using anything but simple integers. what this looks like in realisation would be having a one byte each for x and y positions (or two for x, if you choose a factor greater than two and thus end up with more than 192 horizontal logical pixels mapped to your 96 physical pixels), and one byte each for the x and y velocities (or a nibble, if you want to conserve space). then just add the velocities to the positions each frame and then map the resulting logical positions to their physical positions with a quick division by your chosen factor of two (sure, other factors could be used, but they would be MUCH slower). thus, if you chose a factor of four and only set the x velocity to 1, your bullet would only "drift" over one physical pixel every 4 frames.
Yea this is what I was thinking about doing. Thanks for the help.

18
Axe / Re: Problem with shooter code
« on: August 04, 2013, 05:37:35 am »
What you want is fixed point math, which is pretty fast. Also take a look at Bresenham's algorithm. It's a very simple line drawing algorithm and I'm sure it can be used to move a bullet around. ;)
Yea thats what I am looking for, but I have no idea how I would implement that. Also that looks like it can only determine if a point is supposed to be where it is, the main problem I am having is how to calculate a points position in the first place given its Y value.

19
Axe / Re: Problem with shooter code
« on: August 04, 2013, 04:13:11 am »
So heres another interesting problem (math oh noes):
Right now bullets can only move up/down depending on a value controlling that. Pretty much thats kinda boring and I wanted bullets to sorta drift to the side a bit towards a player (if you guys have played galaga) when fired by enemies to make it a bit more difficult. Lets say the enemy ship was at 3,30 and you were at 1,10. Normally I'd just make another value for the Y direction per cycle and base it off the slope between those points (-.1). Adding this to the current Y every cycle would just be ignored until it hit a X position like 20, when it would finally be at 2 (technically at least, with calculator math I think it rounds down so it would be 2 right off the start but thats close enough). Problem is that uses floating points and signed numbers which seems really difficult to do, so I was thinking why not just add 4 extra bytes to each bullet, 2 being the x and y it was fired from and 2 more for the x and y destination. Because the bullet will move 1 pixel per cycle down, the slope could be calculated every cycle and only add/subtract the position if it actually equals something (e.g. (1/10)*2, nothing (1/10)*10 returns 1), but this still calls for signed numbers and some pretty complex math to be done over and over. So knowing that people here have done really amazing looking shooters before, I thought someone might have some magical solution to this problem or something. If not I can just have the enemies shoot straight down but yea.

20
Axe / Re: Problem with shooter code
« on: August 04, 2013, 12:40:27 am »
On line 92, should If J>6 be If {J-2}>6 instead?
Wow I'm pretty stupid not to have seen that lol. Oh well that happens when you code for a long time without a break lol.

21
Axe / Re: Problem with shooter code
« on: August 04, 2013, 12:17:18 am »
Soo apparently I have another problem I cant fix (stared at this code for a good 15 minutes and couldn't figure it out lol). Pretty much everything in this works fine except the explosions from the dead test enemy dont display. This was after I decided to handle them in a array structure like I have been doing with the bullets and enemies. I cant tell if its a drawing issue with the sprites or a logic issue where the explosions are processed but maybe one of you can help. Helpful infos: C (number of explosions) gets 1 added to it when a enemies health hits 0 (!If {J-4}), and a new explosion entry is added at the current enemy position {J-1},{J}. The third value for explosions is the sprite offset which gets multiplied by 8 later.
-code removed because copyprotection-

22
Axe / Re: Problem with shooter code
« on: August 03, 2013, 05:20:58 pm »
Sorry for asking a lot of questions here but I think its better than making new threads. So I was wondering about a few things:
1. Are axe programs in the Full 15mhz mode by default
2. Is using things like rotC, flipH and flipV instead of making sprites for different angles better (speed/space wise)
3. I heard that separating if statements (If A:If B) is faster than combining them (If A and B), is this true? Which one uses less space also
and finally
4. Whats the risk of using L3 for data, or is it safer to just use a pseudo list (L2+250 being the start of it) if you know the data in L2 wont extend that far
edit:
Oh yea does sound with the freq command play synchronously (meaning if its told to play for 1 second will it wait 1 second to go to the next command or does it play as stuff is happening)

(also this is what I have so far for my game thing, ignore the completely terrible explosion sprites and stuff)

23
Axe / Re: Problem with shooter code
« on: August 02, 2013, 01:11:24 am »
Yea I came across another thing I wanted to ask about here, With some code like:

0->{I-2}->{I-3} The {I-3} dosent work for some reason when something like 0->A->B would. Is there any way to do that with the value of a pointer thing?

24
Axe / Re: Problem with shooter code
« on: August 01, 2013, 04:23:19 pm »
Also note that Axe is not Basic. The main difference being that Axe is compiled while Basic is not. This means that "forgetting" parentheses in Basic saves space in the executable and in the source (since they are the same), but in Axe, that doesn't save anything for the executable. And saving space in the source only is not useful except if you have a 83+ non-SE. Otherwise, I'd advise you to close your parentheses to avoid mistakes such as writing A+(C=1→A which you understand as A+(C=1)→A but which the parser understands as A+(C=1→A).
Ah yes. I've been coding with ti-basic for a while and its sorta confusing because my brain is still thinking on how I'd do a program in ti-basic when here things like speed dont matter as much.

25
Axe / Problem with shooter code
« on: August 01, 2013, 01:51:47 pm »
So pretty much I was looking at the axe example of a space invaders clone thing and was trying to just get movement and bullets working by using the system they had, just to try to learn the language better. Oddly though even though the code is very close to the example mine crashes after like 3 seconds. Before then it works fine but then a bullet sprite appears in the bottom left corner for some reason. Heres the code that isnt working:

Code: [Select]
.TEST
[002442DBE7BD2400->Pic1
[0000183C3C240000->Pic2
DiagnosticOff
ClrDraw
DrawInv

44->X
54->Y
0->B->E->T
Repeat getKey(15)
sub(D
DispGraph
sub(D
If getKey(2) and (X!=1
X-1->X
End
If getKey(3) and (X!=87
X+1->X
End
If getKey(4) and (Y!=1
Y-1->Y
End
If getKey(1) and (Y!=55
Y+1->Y
End
If getKey(54) and (T=0
B+1->B*3+L1->I
0->{I-2}
X->{I-1}
Y->{I}
15->T
End
T=0+T-1->T

For(I,0,B
I*3+L1->J
{J-2}-1+{J}->{J}
If {J}=57 or ({J}=0
B*3+L1->K
Copy(J,K,3)^^r
B-1->B
End
End
End
ClrDraw
ClrHome
Return

Lbl D
Pt-Change(X,Y,Pic1
For(I,0,B
Pt-Change({I*3+L1-1},{I*3+L1},Pic2
End

And what happens when I try to do stuff:


Dunno if this is the right place to ask this but any help would be nice

26
TI Z80 / Pure Ti-Basic command line thingy
« on: July 09, 2013, 05:41:51 pm »
So recently I have been working on this pretty big project of mine and thought I'd just post it here because a lot of projects end up here eventually.
What makes it different is that most shells I see use lots of libraries/assembly programs to make the filesystem or string parsing easier, but to me I feel like that would be cheating in a way, which is why I am doing it purely in ti-basic. It also will be only one file (other than a 20 byte assembly program to enable lowercase text) instead of being split into a ton of peices and cluttering up the calculator.
So far only a few commands work (cd,dc,who,evl, and ext) but there will be more later.
Current stuffs:


-General Infos-
Filesystem:
Tape-style filesystem (file header, then content all in one big string)
-File Headers: 16 Tokens
-Dir Headers: 13 Tokens
Max 99 Files/99 Dirs/10 Users
999 tokens per file, 99 tokens for file/dir names

Filesystem Layout:
dev - Top dir, equivalent of C:\ in windows or / in linux.
dev/bin - System data (user file, environment vars, os config)
dev/usr - User folders go here on account creation, general storage
dev/msc - Programs go here (installed or otherwise)

Var Usage:
Str0 - HDD
Str1 - RAM
Str2 - Network Transfer
Str3 - Input Buffer
Str4 - Parsed Command
Str5 - Parsed Argument
I,J - General Looping
X,Y,Z - Optimization Vars

Current Commands:
cd - Change dir, operates like cd on any other command line except it can't parse paths yet (local folders only and ..)
dc - Dir contents, equivalent of ls on linux or dir on windows. Returns the format: [File/Dir Name|File/Dir:Permission Value]
who - Current user, equivalent of whoami on linux. Gets current uID from ram, parses usr.sd file, displays the login name.
evl - Evaluate, just passes stuff through the expr() command.
ext - Exit, cleans up everything (except hard drive is persistence is enabled in the config, not yet tho) and exits.

Future Plans:
File/Dir moving/deleting/editing
User creation/deletion, password hashing
File permissions based on users
Really basic interpreted coding language
Network connecting/disconnecting on specified port
File sending/receiving calculator to calculator
Remote shell possibly
Compression/Decompression for files
Installers for extra commands or something

If anyone has any comments or suggestions feel free to post them.

Pages: 1 [2]