(note that I haven't looked at any tutorials for this, so please excuse/explain any errors the code has)

So I want to make a simple(ish?) platformer- after toying around with some different things, I settled on this code: http://pastebin.com/340Mj2k9 (prgmDELAY is this but with R as the variable instead of A).

I want to add obstacles to it, though- I know I could do normal collision detection with this method but I want the obstacles to be randomly placed [say, Output(randInt(2,25),randInt(2,9),---)] and the only way I can think of that this would work is if I could detect something in a certain cell.

soo... yeah. What the title says.
You can't do exactly what you want, but you can still do something like it. Your code that places it randomly should place it in a string or matrix, and you should use that for your collision detection. So instead of Output(randInt(2,25),randInt(2,9 something like

Code:

randInt(2,25->A
randInt(2,9->B
1->[A](A,B
Output(A,B,"X

And then you would check matrix [A] for the collision.

Hope that helps!
merthsoft wrote:
You can't do exactly what you want, but you can still do something like it. Your code that places it randomly should place it in a string or matrix, and you should use that for your collision detection. So instead of Output(randInt(2,25),randInt(2,9 something like

Code:

randInt(2,25->A
randInt(2,9->B
1->[A](A,B
Output(A,B,"X

And then you would check matrix [A] for the collision.

Hope that helps!


Ohhh, that makes a lot of sense! Thanks Smile

edit: for future reference: The randInt needs to have a closing parenthesis, otherwise it'll throw an ERR:INVALID DIM. So:


Code:

randInt(2,25)->A
randInt(2,8)->B
1->[A](A,B)
Output(A,B,"X")


and for this particular game, the code would be:


Code:

randInt(2,22)->A
randInt(2,8)->B
1->[A](A,B)
1->[A](A,B+1)
1->[A](A,B+2)
Output(A,B,"---")
M. I. Wright wrote:

edit: for future reference: The randInt needs to have a closing parenthesis, otherwise it'll throw an ERR:INVALID DIM.
I don't get an error when I do that. My guess is that that's actually happening because of the Output. It should actually be Output(B,A.
merthsoft wrote:
M. I. Wright wrote:

edit: for future reference: The randInt needs to have a closing parenthesis, otherwise it'll throw an ERR:INVALID DIM.
I don't get an error when I do that. My guess is that that's actually happening because of the Output. It should actually be Output(B,A.


Nah, I tried changing the other things before I added closing parenthesis. Maybe it's the calculator? (TI 84+CSE here)

Also- I've figured out how to "check the matrix" for collision, but it required using the Matr►List() command.
Is there any way I could "check" it without turning it into a list?
I'm also using an 84+CSE:


You shouldn't need to turn the matrix into a list. Just do [A](A,B or whatever the coordinate is to get the value at that location.
merthsoft wrote:
I'm also using an 84+CSE:

...weird. I'll try it again without the closing parenthesis.
For future reference, how do I record my screen? (edit: or are you just recording the screen of jsTified/wabbitemu/another emulator?)


Quote:
You shouldn't need to turn the matrix into a list. Just do [A](A,B or whatever the coordinate is to get the value at that location.


Oh, duh. ._.
I just used jsTIfied for that.
  
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 1 of 1
» 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