Elements in list code for different textures, etc, and when the program encounters an instance of X in the list it draws said texture.
jpez wrote:
Darn, I wish had seen this topic earlier. Very impressive, kirb!
Pretty 1337, no? Do you agree these should go in the guide? -
calc84maniac
- eZ80 Guru (Posts: 1630)
- 01 Aug 2006 01:13:34 pm
- Last edited by calc84maniac on 24 Aug 2006 03:41:18 pm; edited 1 time in total
A small routine that returns how many times k is in L:
sum(k=L
Simple, eh?
sum(k=L
Simple, eh?
We were talking about something similiar to this at TIFW. If you want to see if a number is in a list, you can simply do max(K=L . You can also do max(K={24,25,26,34} and A=/={0,0,96,64 to check for multiple conditionals (ie If the user pressed left and A does not equal the left bounds of its movement).
Ooooh, this could be excellent for saving space. What it wouldn't be good for is speeding up the program; lists are notoriously slow to process.
- tifreak8x
- Guru (Posts: 11012)
- 01 Aug 2006 02:58:00 pm
- Last edited by tifreak8x on 01 Aug 2006 03:19:34 pm; edited 1 time in total
Kerm, I use this to detect if the arrow keys are pressed, and barely notice any lag. Since I do the more complex A-(K=etc stuff, I use:
If max(K={24,25,26,34:CODE TO CLEAR CHARACTER
Maybe you should take a closer look at the 1337 section on my forums...
If max(K={24,25,26,34:CODE TO CLEAR CHARACTER
Maybe you should take a closer look at the 1337 section on my forums...
Perhaps I should do so; if you've got more stuff like this there, it could be quite the valuable resource. Come to think of it, I believe SC2 does that optimization...
you should, we have quite a few interesting discussions on there, using Max, gragh databases, and well, just a bunch of other odd things not many people know about.
Yep. There are also many skilled programmers over there so you get some nice discussions and great optimizations when a new routine is presented. I used to use sum( but found out at TIFW that max( is faster. If you check the code to the Mario platformer I made, it uses max( frequently as a short way of saying If A=1 and B=1 or A=2 and B=2 etc.
tifreak8x wrote:
Uh, let's not and say we did, k?
Or we could do so and say we didn't, or even do so and say we did! Heh, I won't take you over for now.... or will I?!? 0x5.
» Goto page Previous 1, 2, 3 Next
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 2 of 3
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement