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
Bhaliar


Member


Joined: 16 Nov 2009
Posts: 221

Posted: 18 Jun 2010 08:07:40 am    Post subject:

Okay, so I have tried and successfully failed to make a code that allows a player to jump. I don't mean where you can go straight up and move over at the same time. I mean like he jumps up and over a specific amount. My main problem is i try to do it using a pixel on the graph, and I also use collision detection and make a stair like thing. What is the recommended way to check if you are colliding with something as you go down, and jumping up and over?
Back to top
tifreak8x


Elite


Joined: 27 Aug 2005
Posts: 956

Posted: 20 Jun 2010 06:20:45 pm    Post subject:

Are you using any standard of map collision detection already? That would be the easiest way. Otherwise, you would need to utilize Pxl-test( I believe it is.

I personally would make it easier on myself and have some form of string 'map' to do the detecting for me.
Back to top
Deep Thought


Advanced Newbie


Joined: 09 Jun 2009
Posts: 59

Posted: 21 Jun 2010 04:31:44 pm    Post subject:

Don't really understand what you're asking, but here's my version of it.
I used to use map collision, but when I'm using graphscreen graphics, it gets really messy. Instead, this is my general jump/fall routine:

1. Check for [tt]getKey=24[/tt] or [tt]getKey=26[/tt] and move accordingly, but don't change the display yet.
2. Check for [tt]getKey=25[/tt] and the pixels underneath the character to be 0 (it doesn't make sense to jump from thin air to another layer of thin air) and [tt]U=0[/tt] (you'll see). If the [tt] and [/tt] combination is true, assign the number of blocks you want to jump up (say, 3) to some real variable like [tt]U[/tt], but don't move or change the display yet.
3. Check to see if [tt]U[/tt] is positive. If it is, it means that during the past, say, 3 passes, the UP key was pressed, so the character's still going up. Decrease [tt]U[/tt] by one and move accordingly, but don't change the display yet.
4. Check to see if the pixels underneeath the character are 0 and if [tt]U[/tt] is also equal to zero (you don't want to fall if you're still jumping). If so, move accordingly.
5. Now change the display to account for all that at once.


Last edited by Guest on 21 Jun 2010 04:34:27 pm; edited 1 time in total
Back to top
Babyboy


Advanced Member


Joined: 11 Jun 2003
Posts: 499

Posted: 12 Apr 2011 11:00:06 pm    Post subject:

hmm... this one could be fun, although im sure it will end up slow.

if the x is always going to be the same change, then you can use it as a constant for your equation

the Y is where it gets fun. have you thought of utilizing the inherent up/down nature of a quadratic function?

-Ax^2+B would give you a curve, change A to make it wider (inverse to number size, 1 will be wider than 4 generally but is dependent on the B number for actual movement.)

B is as high as your character will get.

take the table of x^2 use it as your X and Y, just make sure your X does not go below 0 (if on flat land)

christ it has been a long time... umm... encase it all in a "While pxl-test(X spot in table+1, Y spot in table+1) does not = 1
to make sure that you arent running into anything BEFORE you move, if it comes back as solid it will break the loop. just make sure you have a solid floor
otherwise it will continue going down the table and move you further.

the idea is to get the Y in Y=Ax^2+Bx to be the distance you jump. but with the +B you can change how high he jumps without affecting the X movement.


this may be really fragmented. so RFC? i think there is something here though, and it would be faster than using if statements to determine max height.




















[/code]
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 13 Apr 2011 05:41:00 pm    Post subject:

Sorry, I deleted the double post :/
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