781
Axe / Re: Problem with shooter code
« on: August 06, 2013, 08:55:05 pm »
For the AI, all I did was have it randomly move toward the user. As an example, if playerX>enemyX and rand^2 (which returns 0 or 1) is 1, then do enemyX++
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. 781
Axe / Re: Problem with shooter code« on: August 06, 2013, 08:55:05 pm »
For the AI, all I did was have it randomly move toward the user. As an example, if playerX>enemyX and rand^2 (which returns 0 or 1) is 1, then do enemyX++
782
Axe / Re: Problem with shooter code« on: August 06, 2013, 05:39:19 pm »
That looks great! I was in town earlier today with no obligations, so I programmed for a bit and converted my BASIC code to Axe and then modified it a little. It currently only does one bullet at a time, but I am going to add in code to have a bullet buffer. I managed to figure out a way to make sure bullet movement was not bugged except for one case with an acceptable bug (I think). Shooting vertically will cause it to shift 1 pixel off course, but I don't think that should be a problem. Anyways, see the screenshot
EDIT: Updated the code, now it uses a bullet buffer. It currently handles 64 bullets on screen at a time and it is still at 6MHz. Feel free to use any of the code or look at it or whatever! 783
Axe / Re: Problem with shooter code« on: August 05, 2013, 11:53:11 pm »
This is the BASIC line drawing routine (I don't have easy access to my calculator at the moment, so this is just what I wrote in my notebook):
Code: [Select] ;draw from B,C to D,E (b=x1) In this part of the code above: Code: [Select] While A<0 To work better, it should be more like this in Axe:Code: [Select] If 0 That skips the first pixel plotting which is only a problem if you are inverting the pixels. Hopefully you can derive a working algorithm from this!
784
Axe / Re: Problem with shooter code« on: August 05, 2013, 11:19:00 pm »
Hmm, I recognise the problem, but I did not see the issue in your source code immediately. Hopefully I will take a look at it tomorrow and possibly figure out the issue.
I would also like to point out that you can do signed comparisons. For example, {J-6}<<0 to see if it went below zero. I think Axe probably does an auto-optimisation for that. I tried my attempt above and found that it doesn't work (I forgot some of the nuances of Axe ). I did get it to work in BASIC, though. 785
TI Z80 / Re: gCn picker« on: August 05, 2013, 06:34:13 am »
Wow, that is pretty cool, Sorunome o.o That makes it look rather easy to use!
786
Axe / Re: Problem with shooter code« on: August 04, 2013, 11:59:46 pm »
Hey LemonDrop, I am not sure if this is the Bresenham method, but this is a line drawing algorithm I came up with a few years ago that is fast and easy to implement in Axe, Assembly, BASIC, Grammer -- you name it. Modified, instead of drawing a line, you can make a bullet follow a trajectory. This will also work smoothly using the the inflated coordinates that shmibs was referring to (this is an excellent technique, especially when you start doing physicsy things) or just the regular 96x64 pixel area. Anyways, the basic pseudo-code looks like this:
Code: [Select] ;Given : (x1,y1) and (x2,y2) While that may look complicated, it actually simplifies quite a bit when put in use. To describe the algorithm, there is an accumulator that starts at 1/2 the width (because we are using integers, I store the width to the accumulator and then double width and height, so the accumulator is half the width). Then at every cycle, a much more general algorithm might increment y and add height/width to to x. However, we cannot use non-integers, so we need to be more clever. This is why I have an accumulator. What we could do is add height to the accumulator and if the acc>width, then we need to increment the x coordinate. To determine how many times we need to increment, just subtract accumulator-width until accumulator<width, each time incrementing x and plotting a pixel. In the algorithm above, it is more optimised for assembly and instead of doing accumulator+height, I do accumulator-height until accumulator<0 (which the processor automatically recognises without needing to do a compare).Anyways, now for some actual Axe code! (Note: I am not a very knowledgeable Axe coder, so there may be many optimisations to be had!) The first thing we are going to need to take note of is that we aren't drawing a whole line at once (unless you are making a laser effect) so it will be more useful to make a subroutine that returns the coordinates of the next pixel. As well, in the event that we have multiple bullets on screen, we might want to make the routine even more flexible to work with a buffer of bullet data so that we don't tie up variables. Here we go: Code: [Select] Lbl BNEXT I have not tested that code, so I doubt it will work, but just in case it does, GDB1 should point to a buffer large enough to hold the bullet data (in the code above, it limits to 10 bullets, so 9*10+1 = 91 bytes). This buffer should be zeroed, and GDB1+9*9+1→GDB1Z should be defined (GDB1Z points to the last bullet). The 3 routines, if they work, are: BNEXT(ptr) : ptr points to 9 bytes of bullet data. Returns X,Y as the coordinates of the bullet. DELB(ptr) : ptr points to the 9 bytes of the bullet data to remove from the bullet buffer. ADDB(x1,y1,x2,y2) : If there is room on the bullet buffer, the bullet trajectory is added. As a note, BNEXT automatically removes the bullet if it reaches its destination coordinate. If you want it to continue past the destination until it goes offscreen, the code can be modified. I hope it works, but I am too tired to test it tonight. I need sleep 787
News / Re: TI-84 Plus Orion, the Talking Graphing Calculator now available« on: July 29, 2013, 10:23:13 pm »WHAT THE WHAT?! Sounds for games with no hassle...Well, we don't know yet how easy it is to communicate with the Orion component through assembly. As well, I would imagine that much of the sound is preloaded onto the Orion device, but it might be neat if you can pass text to it and it reads it. Also, $600. 788
News / Re: TI-84 Plus Orion, the Talking Graphing Calculator now available« on: July 29, 2013, 09:16:07 pm »Yeah headphones might be a concern if someone writes a counterfeit copy of an existing program allowed at a test that actually tells the test answers with headphones plugged in or something. However, no headphone support might be annoying for other students who constantly hears a calc talking.Oh, I hadn't even thought of that o.o I was more thinking about during math tests, without headphones your calculator would be telling all of your answers out loud. 789
News / Re: TI-84 Plus Orion, the Talking Graphing Calculator now available« on: July 29, 2013, 08:40:43 pm »
So... I am assuming headphones are used during tests? TI does tend to be worried about that kind of thing
This is pretty cool, though The speech is actually pretty decent, I think. EDIT: Also, I think that if I ever go blind, I could still use my calculator just fine >.> I do the math in my head, anyways, and I otherwise know where everything is. 790
I haven't added in any of the shell parts that I wanted to add in, yet, but I did rewrite parts of the graphics code. I am emulating the screen with a different approach and that allowed me to make a slightly faster LCD update routine and a much faster clipped sprite routine. The end product is about a 23% speed boost in my pong example
Also, going through the code, I think I can try to give it much better organisation and possibly reduce the size and increase the speed. It is quite a mess at the moment. 791
TI Z80 / Re: CopyProg« on: July 29, 2013, 06:55:00 am »
I did not have any issues when I tried it and I tried values of R from 0 to 7 (at this point, it just kept returning the last line as it should). I tried it with the program archived and unarchived and it didn't make a difference, so maybe I forgot to upload something...?
792
Casio Calculators / Re: [Prizm C] Mandelbrot Set« on: July 28, 2013, 10:36:27 pm »
Oh my gosh, I totally want to learn enough ARM assembly to do that on my NSpire o.o
793
TI-BASIC / Re: Check if two "occurences"« on: July 28, 2013, 03:26:25 pm »
If you use multiple arguments, the first list gets sorted, the other lists get their elements swapped around so that they stay with the elements in the first list. So if you want to make sure that the lists are set back to the same order they were in, you can do:
Code: [Select] cumSum(binomcdf(dim(L1)-1,0→L3 And that returns 1 if there are any duplicates, 0 otherwise, and keeps L1 and L2 unchanged.
794
TI-BASIC / Re: Check if two "occurences"« on: July 28, 2013, 03:16:34 pm »
Hmm, maybe something like this? :
Code: [Select] SortA(L1,L2 EDIT: This assumes the lists have more than 1 element. Also, nice idea with the matrixfeytontias stuff. 795
Casio Calculators / Re: [Prizm C] Mandelbrot Set« on: July 28, 2013, 01:16:17 pm »
It took 46 seconds at 94.3MHz, but about 75 seconds at normal speed.
|
|