This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 19 Nov 2009 10:32:57 pm    Post subject:

Ok so iam making a game with maps using matrices for all of the hit detection. I have both money and movement working but i want to add a boulder that you can move around by pushing around from all four sides. I have tried several times but my code seemes large and bulky i was wondering if anyone would be willing to help me. i am using matrix A for anyone who cares A=1 for a wall A=3 for money
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 19 Nov 2009 11:49:37 pm    Post subject:

and im asuming ur using Xlib's/Celtic+Xlib's Matrix tile mapper right? Well in this case, when the boulder detects it has been hit, record the last movement you had, so.. idk how ur doing ur movement.. but try to add a variable for the X Coordinate (and i dont mean the one ur using for coordinates.. i mean like.. say... Speed.. is S, is X going to go +1 or -1 (Right, or Left)? so like say S was ur movement variable.. and X is what u actually use for the Xcoordinate.. S+X->X.. So if u were moving Right>> S=1, if u moved left, S=-1, and then same goes with Y..) Im not really quite sure where im going with this, cause u wouldnt be able to tell which movement happened.. X_X nvm.. idk.

EDIT: Now that i look at this, its really confusing, i was thinking of like 5 ways to do this at the same time =D..
For example.. for my Bouncing ball Game, i have Speed = S, and my Y coordinate = Y

Everytime i had a loop, S would decrease by .01 or something, and if i pressed up, S would increase by .1, So what i would do is.. S+Y->Y (say its going down.. -3+50->Y..Y would become 47..) so with the 'S' you would know which direction the Y coordinate just traveled (Of course ur 'S' isnt gonna be any higher then 1, or lower then -1)


Last edited by Guest on 19 Nov 2009 11:53:47 pm; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 20 Nov 2009 12:00:55 am    Post subject:

No i dont have a lib on my caculator its in pure basic i am doing an 8*16 map
xxxxxxxxxxxxxxxx
x & x
x x
x x
x x
x x
x x x * x
xxxxxxxxxxxxxxxx
&=guy
x=wall
*=exit
i want to add a o as a bolder

sorta like this
sorry for being unclear

Edit : well sorta like that map but with spaces


Last edited by Guest on 20 Nov 2009 12:07:36 am; edited 1 time in total
Back to top
calcdude84se


Member


Joined: 09 Aug 2009
Posts: 207

Posted: 20 Nov 2009 04:38:23 pm    Post subject:

First of all, what method do you use for collision detection? (With the walls, of course)
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 20 Nov 2009 04:48:15 pm    Post subject:

I use the getkey codes and then test


if [A](X,Y)=1


1 is a wall x,y is player
if it does than i restore the old x and y if it doesn't i move the character

X → S
Y → Q
X+(k=34 And X<Cool-(k=25and X>0 )→ X
Y+(K=26 and Y ≤ 16)-(K=24 ≥1)→ YIF [A](X,Y)=1: Then
S → X
Q → Y
End
Outout(x,y,"m


Last edited by Guest on 20 Nov 2009 04:49:29 pm; edited 1 time in total
Back to top
Flofloflo


Member


Joined: 07 Nov 2007
Posts: 120

Posted: 20 Nov 2009 06:33:31 pm    Post subject:

Store a variable in the matrix for a boulder. When you update the coordinate of your player, don't change the actual coordinate, but use 'surrogate coordinates'. Check if there's a boulder on that location, next, check if the coordinate at your current coordinate + twice the 'movement function' is free. If so, update your player's coordinate with the movement function, and the boulder coordinate with the same movement function.
I tried working it out but I'm to tired right now. I'll try again tommorow.
I once made a game with movable boulders, but I used pxl-test instead of matrices witch works quite good, using a matrix is a little more complicated but I guess it's doable.


Last edited by Guest on 20 Nov 2009 06:42:05 pm; edited 1 time in total
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 20 Nov 2009 06:52:31 pm    Post subject:

dxfan101010 wrote:
I use the getkey codes and then test


if [A](X,Y)=1


1 is a wall x,y is player
if it does than i restore the old x and y if it doesn't i move the character

X → S
Y → Q
X+(k=34 And X<Cool-(k=25and X>0 )→ X
Y+(K=26 and Y ≤ 16)-(K=24 ≥1)→ YIF [A](X,Y)=1: Then
S → X
Q → Y
End
Outout(x,y,"m

yea

but for my game, supaplex (asm) i hard coded it because it get complicated when the boulder is near an edge and you try to lookup an location out of bounds

i dont see an easy way to fix that atm.. except a whole lot of IF's
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 20 Nov 2009 08:16:56 pm    Post subject:

Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 20 Nov 2009 08:17:40 pm    Post subject:

Ok its not that big a deal it was a challenge from a friend that i thought id give a try
Back to top
GloryMXE7
Puzzleman 3000


Active Member


Joined: 02 Nov 2008
Posts: 604

Posted: 20 Nov 2009 10:26:47 pm    Post subject:

heres an easy way to determine if a Location is in bounds using only one if statement

if (16-X)*(X-1)≥0 And (8-Y)*(Y-8)≥0
then (X,Y) is in bounds
for the graph screen you just change 16 to 94,8 to 62,and the ones to zeros.


Last edited by Guest on 20 Nov 2009 10:27:09 pm; edited 1 time in total
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 21 Nov 2009 07:05:37 am    Post subject:

GloryMXE7 wrote:
heres an easy way to determine if a Location is in bounds using only one if statement

if (16-X)*(X-1)≥0 And (8-Y)*(Y-8)≥0
then (X,Y) is in bounds
for the graph screen you just change 16 to 94,8 to 62,and the ones to zeros.


yea i know

bit it isnt that easly if you write it in asm, you probably have different routines for all keys anyway
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement