TIB: rpg game


[Prev][Next][Index][Thread]

TIB: rpg game




>        First, the matrix will change as the level progresses, but i am not that far
> yet.  A and B represent the set of coordinates taken from the two lists.  L1
> and L2 represent the walls in the level, L1=x var, L2 =y var.  So when you
> move the cursor, it adds one to a&b which are originally zero, then says if
> new cursor x=L1(a)<-(which var in the list) and new cursor y=L2(b) then store
> the old cursor vars as the new cursor position so you cant walk through the
> wall. Else add one to a & b, and reapeat the loop; it does this loop until it
> reaches the end of the list or encounters a matching set and therefore checked
> all of the possible walls for the cursor.  so basically, L1 and L2 contain
> every wall edge on the screen, L1 bieng x L2 bieng y, and i use a variable
> that increases by one each loop to determine the set of coordinates taken from
> L1&L2 then say if this set of coordinates =the cursor coordinates, use the old
> cursor coordinates.
> 

Okay, I think you'll find that this version is much more to your liking.
:ClrHome:"*./+_
:For(K,1,8
:For(T,1,16
:Output(K,T,sub(Ans,[J](K,T),1
:End
:End
:5->C:1->D
:Repeat 0
:Output(C,D,"O
:Repeat Ans
:getKey
:End
:Ans->@
:C+(@=34)-(@=25->E
:D+(@=26)-(@=24
:If not(E(9-E)Ans(17-Ans
:End
:If 5<>[J](E,Ans
:End
:Output(C,D,"_
:Ans->D
:E->C
:End

This should _greatly_ increase the speed.  Also, note that the improved
'drawing the scree' algorithm.  If you compare the new versus the old,
you should find that this new program draws the screen roughly twice as
fast.  With this new program you can completely eliminate both lists,
too.  All in all, the new program is roughly half the size, several
times faster, and an automatic savings of roughly 700 bytes by the
elimination of the lists.  Not to bad, eh?  I would still like to do
something about using the matrix...

Jody Snider
jody1@alaska.net

P.S.  I sent this to the list just in case somebody out there could see
some place for improvement that I missed.