Very nice, I agree with CDI on that.
CDI wrote:
Just a helpful hint, if you store your pickups in a list, you can have conditionals based on one time pickups. Say the gun, you can have part of the matrix be "4L1(1)" as opposed to just "4" and make L1(1) be 0 when you pick up the gun, so you can only get it once. Just a thought.


I forgot all about being able to do that in matrices, thanks for the reminder. Very Happy
Bump

I have thought on this some, and I am curious on an experts opinion. Would having movement be the main loop, possibly enemy movement (if I add some) all that is in the main loop, and have all the extras, such as the events, attacks, etc.. outside of it so that it doesn't go through all the conditionals. My only problem about just doing that is needing a Goto, I think, unless 2 while loops inside of one, like this:


Code:
:While W=1
:2->W
:While W=2
:"Main movement loop"
:If a list of buttons are pressed, store 3 to W
:End
:While W=3
:"Rest of code"
:End
:End


Would that work?
What's wrong with:


Code:
While some condition
random code
key-independent stuff
getKey->K
if not(K:End
key-dependent stuff
End
KermMartian wrote:
What's wrong with:


Code:
While some condition
random code
key-independent stuff
getKey->K
if not(K:End
key-dependent stuff
End


The fact there are going to be quite a few weapons in all, I am hoping for about 6 at the most, if all goes well, and those are all key-dependent, along with the movement, just having 2 weapons slows it down quite a bit.
So you're saying not much of it could go in the key-independent section?
KermMartian wrote:
So you're saying not much of it could go in the key-independent section?


The only things that will be key-independent is the map rendering and determining what weapons and items you have.
Sonlen wrote:
KermMartian wrote:
So you're saying not much of it could go in the key-independent section?


The only things that will be key-independent is the map rendering and determining what weapons and items you have.
That's perfect! Then your non-keypress section will be small, and that top/inner loop will be nice and tight!
KermMartian wrote:
Sonlen wrote:
KermMartian wrote:
So you're saying not much of it could go in the key-independent section?


The only things that will be key-independent is the map rendering and determining what weapons and items you have.
That's perfect! Then your non-keypress section will be small, and that top/inner loop will be nice and tight!


What I decided to try and do is separate the attacking and movement into 2 loops, one is activated if a certain button is pressed. The issue is I need at least 1 weapon usable while jumping, probably the sword right now as it is the smallest in number of commands and conditionals right now.

Is there a way to check if you X,Y coordinates are within 2 and 7 for X for 2 and 15 for Y with one condition, so it is like X>1 and X<15 but with lets say a max() in the conditional?

I guess I could add a bit more to this also, what if I the want to see if the location on the matrix in a certain direction is a 0, >6, <10, or 12 without using a massive number of conditions in one If statement?
Regarding part 1:
Code:
If abs(X-4.5)<=2.5
Which is the same as
Code:
If X>=2 And X<=7
I use this code to generate that (It revolves around a math concept I could never remember):
Code:
Input "HIGH:",A
Input "LOW:",B
abs(A+B)/2
Text(0,0,"Abs(A-",Ans,")<",Max(A,B)-Ans
Which will give you the statement for a one part conditional: A<High And A>Low. Hope that helps.

For the second part, you'd have to ask a certain Weregoose to shorten that, I would just do the individual parts, because it will be faster than doing insane math.
Sonlen wrote:
Is there a way to check if you X,Y coordinates are within 2 and 7 for X for 2 and 15 for Y with one condition, so it is like X>1 and X<15 but with lets say a max() in the conditional?

I guess I could add a bit more to this also, what if I the want to see if the location on the matrix in a certain direction is a 0, >6, <10, or 12 without using a massive number of conditions in one If statement?

You're going to have to elaborate more on that, plus I think you made some errors that make it unworkable.

Simplifying _player1537's part-one gives 6>abs(2X-9, which is the same size as the original, but I'm not sure that it's faster.

And another rendition of his generating code would be: .5abs({A-B,A+B
Weregoose wrote:
Sonlen wrote:
Is there a way to check if you X,Y coordinates are within 2 and 7 for X for 2 and 15 for Y with one condition, so it is like X>1 and X<15 but with lets say a max() in the conditional?

I guess I could add a bit more to this also, what if I the want to see if the location on the matrix in a certain direction is a 0, >6, <10, or 12 without using a massive number of conditions in one If statement?

You're going to have to elaborate more on that, plus I think you made some errors that make it unworkable.


A couple questions on that:
1. How would it be unworkable?
2. How could I elaborate even more? If the coordinate you are looking at is a 0, between 6 and 10 (>6 and <10), or a 12, then the condition will be true.

Does that bit help?
The implicit OR between ">6, <10" from your last post did it in.

What is the possible range for the coordinate?
Weregoose wrote:
The implicit OR between ">6, <10" from your last post did it in.

What is the possible range for the coordinate?


I am using a matrix for a map(whats new :p). So it is 8x16, and the possible numbers in it I am planning on having 0-20 hopefully tops, I shouldn't need to add anymore then that.
not(fPart(838383/(10X-83

Just go with it. Laughing
Weregoose wrote:
not(fPart(838383/(10X-83

Just go with it. 0x5


I am going with it, but it really is a big number and an not(fPart()) :p
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» 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

 

Advertisement