Hey everybody, I want to make a port of the game daleks, where you run away from the little dudes and make them crash into each other. Suggestions of any kind wanted.
good idea, except I would use the + mark so that It would be less complicated to check if guys had moved to the same space with pxl-test.
Why would you be using pxl-Test( to check that? It's much easier to deal with the lists directly.
true. I did have it check the lists directly in my game. I'll post the code soon, I have to finish typing it on the computer.
Here is what I think the final version of the code should be. As far as I know, this is the best it can get, without bugs.
edit: program updated. now 487 bytes on calc. Also I fixed a smallish bug where you could start out on top of a dalek/robot thingy.
:DelVar ADelVar BClrDraw
:If A=Z and B=Ans
:L₁=L₁(D) and L₂=L₂(D
:For(D,2,C) :For(E,1,C) :If D≠E and L₁(D)=L₁(E) and L₂(D)=L₂(E :Then :0→L₃(D :0→L₃(E :Pt-On(L₁(D),L₂(D :End :End :End
This loop takes nearly twice the time it should to run, because you check every pair of collisions twice. The standard way to go through every pair is the following:
:For(D,1,C :For(E,1,D ...
However, in this case, there's more you can do by performing operations on the entirety of the list at once:
:For(D,1,C) :L₁=L₁(D) and L₂=L₂(D :If 1<sum(Ans :Then :Pt-On(L₁(D),L₂(D :L₃not(Ans→L₃ :End :End
The same thing applies to these operations:
:L₁(D :Ans+3(Ans<A and N)-3(Ans>A and N→L₁(D :L₂(D :Ans+3(Ans<B and N)-3(Ans>B and N→L₂(D
Try this instead:
The one problem with this improvement is that you'd have to redraw all the points at the same time. Since you decided not to use scatter plots, you could do this by adding temporary lists: store the updated L₁ and L₂ to L₄ and L₅, then make a loop in which you erase the point at L₁,L₂ coordinates, and draw it at L₄,L₅ coordinates, then store L₄ and L₅ back to L₁ and L₂.
Thanks, the first improvement worked well, but in all practicality it would be MUCH less efficient to do the second improvement, because of all the complications it would have with erasing and redrawing and how the original equation fits in with the larger loop. If I made a second smaller loop with the same parameters, it would be a waste. However, I was able to improve it a little to this.
I am going to update the code to use the new one variable display that darkstone knight suggested. It should be smaller and faster then. It will though take a while to figure out how it will work.
edit: nvm. The opcode for 1 var displaying was actually larger and kindof slow. I did however find TONS of things that I could optimize other than that.