If you have trouble logging in, try to disable JavaScript temporarily. If that doesn't work, please contact  a d m i n @ c o d e w a l r . u s  with your account nickname.

* WalrusIRC Shoutbox (Support and development thread)

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: TI-Basic Collision Detection  (Read 936 times)

0 Members and 1 Guest are viewing this topic.

Offline SiphonicSugar

  • Full User
  • Posts: 212
  • Post Rating Ratio: +1/-1
  • I wonder...
    • @SiphonicSugar
    • SiphonicS
    • View Profile
  • Gender: Male
TI-Basic Collision Detection
« on: September 22, 2015, 09:46:59 pm »
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-83 Plus, TI-84 Plus, TI-92, TI-84 Plus C SE, TI-Nspire CX, and TI-Nspire CAS with Touchpad
Maybe in 20 years... I'll be better... but until then... I don't know...


Offline c4ooo

  • Super User
  • CW Contest II Winner
  • *
  • Posts: 576
  • Post Rating Ratio: +6/-1
  • The impossible chemical compound.
    • @c4ooo_
    • /u/c4ooo
    • c4ooo
    • View Profile
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #1 on: September 22, 2015, 10:14:13 pm »
Here is some quick code i wrote to accomplish this:
Code: [Select]
"()()()()()()()()
()::::::      ()
():    :      ()
():           ()
():           ()
():    :      ()
()::::::      ()
()()()()()()()()"->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.
-German Kuznetsov
The impossible chemical compound.

Offline SiphonicSugar

  • Full User
  • Posts: 212
  • Post Rating Ratio: +1/-1
  • I wonder...
    • @SiphonicSugar
    • SiphonicS
    • View Profile
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #2 on: September 22, 2015, 10:53:03 pm »
Well, I find this very helpful!  :)
  • Calculators owned: TI-83 Plus, TI-84 Plus, TI-92, TI-84 Plus C SE, TI-Nspire CX, and TI-Nspire CAS with Touchpad
Maybe in 20 years... I'll be better... but until then... I don't know...


Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14086
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #3 on: September 23, 2015, 02:06:15 am »
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-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline SiphonicSugar

  • Full User
  • Posts: 212
  • Post Rating Ratio: +1/-1
  • I wonder...
    • @SiphonicSugar
    • SiphonicS
    • View Profile
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #4 on: September 23, 2015, 09:49:09 pm »
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-83 Plus, TI-84 Plus, TI-92, TI-84 Plus C SE, TI-Nspire CX, and TI-Nspire CAS with Touchpad
Maybe in 20 years... I'll be better... but until then... I don't know...


Online Unicorn

  • Unicorn Overlord of CodeWalrus
  • Super User
  • CW Contest II - 2nd place
  • *
  • Posts: 2575
  • Post Rating Ratio: +4/-2
  • Weeeeeeeeeeeeee!
    • Unicorn808
    • 114/11432
    • View Profile
    • UnicornCalcs
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #5 on: September 24, 2015, 02:34:14 am »
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: TI 84+ CSE TI 83+ SE TI something something



Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14086
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #6 on: September 24, 2015, 04:44:45 am »
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-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline SiphonicSugar

  • Full User
  • Posts: 212
  • Post Rating Ratio: +1/-1
  • I wonder...
    • @SiphonicSugar
    • SiphonicS
    • View Profile
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #7 on: September 24, 2015, 07:56:18 pm »
Okay, thanks.  :D
  • Calculators owned: TI-83 Plus, TI-84 Plus, TI-92, TI-84 Plus C SE, TI-Nspire CX, and TI-Nspire CAS with Touchpad
Maybe in 20 years... I'll be better... but until then... I don't know...


Offline SJCubed

  • Full User
  • Posts: 22
  • Post Rating Ratio: +0/-0
  • Formerly known as jsj795
    • View Profile
  • Gender: Male
  • WalriiPoints: 75
Re: TI-Basic Collision Detection
« Reply #8 on: September 30, 2015, 12:12:58 am »
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

Offline c4ooo

  • Super User
  • CW Contest II Winner
  • *
  • Posts: 576
  • Post Rating Ratio: +6/-1
  • The impossible chemical compound.
    • @c4ooo_
    • /u/c4ooo
    • c4ooo
    • View Profile
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #9 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.
-German Kuznetsov
The impossible chemical compound.

Offline SiphonicSugar

  • Full User
  • Posts: 212
  • Post Rating Ratio: +1/-1
  • I wonder...
    • @SiphonicSugar
    • SiphonicS
    • View Profile
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #10 on: October 01, 2015, 08:57:07 pm »
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-83 Plus, TI-84 Plus, TI-92, TI-84 Plus C SE, TI-Nspire CX, and TI-Nspire CAS with Touchpad
Maybe in 20 years... I'll be better... but until then... I don't know...


Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14086
  • Post Rating Ratio: +71/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: TI-Basic Collision Detection
« Reply #11 on: October 03, 2015, 04:46:26 am »
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
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-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games