Join us on Discord!
You can help CodeWalrus stay online by donating here.

TI-Basic Collision Detection

Started by SiphonicSugar, September 22, 2015, 09:46:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SiphonicSugar

Okay, so I've had the idea of making an RPG for a while.  To keep things organized, I have a couple things written out (like a code flow chart and other stuff that I am to lazy to talk about).  So, I started a topic like this on Omnimaga but people seemed to forget about it, so I guess I'm moving over here.  Anyway, for the tile mapping that I am going to use in my RPG, I decided not to use matrices or lists, but store the maps in a string.  Well, everything works out correctly, and I can display a map on the screen (I'm to lazy to make it so you can change maps right now and I am still trying to find the easiest way to do it), but I do not have collision detection.  I want to be able to have the program do this:

Movement stuff
Test to see if your coordinates are not in a wall or something (I'm using "X" for walls right now)
If you are, then set your coordinates to what you had before you moved

But I have no idea how to do this, like test to see if there is an "X" where you want to move your player.
  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

c4ooo

Here is some quick code i wrote to accomplish this:

"()()()()()()()()
()::::::      ()
():    :      ()
():           ()
():           ()
():    :      ()
()::::::      ()
()()()()()()()()"->Str1
For(Y,1,8
Output(Y,1,sub(Str1,Y*16-15,16
End
5->X
5->Y
While 1
getKey->K
X+(K+26)-(K=24)->A
Y+(k=34)-(K=25)->B
If sub(Str1,B*16-16+A,1)=" "
Then
Output(Y,X," "
Output(B,A,"π"
A->X
B->Y
End
End

As you can probably tell, "π" is the player. The player can walk on top of anything that is a space.

SiphonicSugar

  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

Dream of Omnimaga

My advices:

1) Try to only use like 1-2 different tiles on which it's possible to walk into. That will speed up collision detection since you will only have to check 1 or 2 different characters.

2) If you run into a non-floor tile, make sure that your game exits the walking engine loop and processes the rest of the collision detection outside (eg if you encounter a NPC, door, treasure chest or boss). That might cause some lag when walking into walls, but at least walking on floors will be faster due to having fewer code inside the loop

3) Start small and backup often! RPGs can be overwhelming as first project and they get large fast. For example, see how few dungeons the first Illusiat games had.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

SiphonicSugar

What program or whatever do you recommend that I use for programming?  Because for some reason, I have this idea of programming on calculator, and I didn't know if that was a good idea or not...
  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

Unicorn

I suggest writing the bulk of th program in sourcecoder (it has cloud storage if you have a cemetech acount) so you can do it anywhere you have a computer, and also on-calc if you havesmall problems and a long car ride, or something like that. Make sure to keep each version the same though.
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Dream of Omnimaga

SourceCoder is what I use most of the time, but it requires an Internet connection. If you don't want to have to get on a website to use it, then TokenIDE might be better for you. TI-Connect CE has an editor as well but I don't know how good it is.


Also, backup often, very often, on multiple storage mediums.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

SiphonicSugar

  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

SJCubed

I use TokenIDE myself. Good luck with the RPG! I'm trying to finish what I tried to make 4-5 years ago right now >.<
  • Calculators owned: TI-84+SE

c4ooo

Actualy, you dont need to use for loops to render the map. You can render the map much faster with just Output(1,1,Str1)

Personally, i would recomend prgramming on the calc with a shell like doors or zstart. As long as every thing as archived, it should be easier.

SiphonicSugar

I think that I am going to start using Doors instead of MirageOS.

Doors has a cursor!
I didn't want to use it at first because I did not like the CSE version.
  • Calculators owned: TI-89, TI-84 Plus, TI-92, TI-84 Plus C SE, and TI-Nspire CAS with Touchpad
I'm just trying to grab some inspiration. :P

Dream of Omnimaga

I personally don't like the mouse, but I like DCS better than Mirage for a few things: First of all, it has instant Goto when exiting programs and going in the code, we can read archived program code (although DCSE8 implements it better) and unlike Mirage, folders won't get deleted after a RAM clear.


Also on the CSE you don't have much choice to use DCSE because it's the only shell available. :P
Quote from: c4ooo on October 01, 2015, 06:56:35 PM
Actualy, you dont need to use for loops to render the map. You can render the map much faster with just Output(1,1,Str1)

Personally, i would recomend prgramming on the calc with a shell like doors or zstart. As long as every thing as archived, it should be easier.
Indeed. You will be able to draw your map instantly that way.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal