Author Topic: BASIC movement  (Read 12457 times)

0 Members and 2 Guests are viewing this topic.

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: BASIC movement
« Reply #15 on: February 17, 2012, 09:54:07 pm »
Maybe, I think they would stay about the same.  The List code really doesn't have much collision detection anyways, just the min max trick

Anyways, I'm starting to understand just how brilliant this code is... it is amazing how it works :)

But isn't it faster to do Repeat Ans:getKey:End:Ans->G ?

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: BASIC movement
« Reply #16 on: February 17, 2012, 10:05:23 pm »
Can someone explain how I can do collision?
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: BASIC movement
« Reply #17 on: February 17, 2012, 10:14:42 pm »
Where it has either A+(getKey stuff)->A and B+(getkey stuff)->B, or the x and y versions,

just add
Code: [Select]
min(8,max(1, to the Y axis variable
and
Code: [Select]
min(16,max(1, to the X axis variable
should work :)

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: BASIC movement
« Reply #18 on: February 17, 2012, 10:26:09 pm »
um, can you show me that in the first code DJ posted? Thats the one I'm using
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: BASIC movement
« Reply #19 on: February 17, 2012, 10:42:12 pm »
Code: [Select]
ClrHome
4->X
5->Y
Repeat G=45
Repeat G
getkey->G
End
Output(X,Y,"
min(16,max(1,Y-(G=24)+(G=26->Y
min(8,max(1,X-(G=25)+(G=34->X
Output(X,Y,"@
End
ClrHome
Stop
There you go! :)

EDIT: if you need me to, I can explain it for you
« Last Edit: February 17, 2012, 10:44:07 pm by chattahippie »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: BASIC movement
« Reply #20 on: February 17, 2012, 10:48:03 pm »
Note that this is only for collision on the screen sides, though.

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: BASIC movement
« Reply #21 on: February 17, 2012, 10:51:58 pm »
Note that this is only for collision on the screen sides, though.
Yes, but it should work for any sized rectangle (aka no walls in the middle of the screen :P )

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: BASIC movement
« Reply #22 on: February 18, 2012, 11:39:25 am »
Well thanks, but I was looking for collision with predrawn things. Like if I had on the screen a question mark, I wouldn't want to run through it
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: BASIC movement
« Reply #23 on: February 18, 2012, 12:18:41 pm »
Here is a way to do that:
Code: [Select]
"
0ANYTHING000000  //Take out the newlines, of course, so the interpreter doesn't freak out
0             0
0             0
0     :)      0
00WORKS!!!1!100 ->Str1  //You can make the map bigger for more space to move

ClrHome
2->X
2->Y
Output(1,1,Str1
Repeat G=45
Repeat G
getkey->G
End
Output(X,Y,"
Y-(G=24)(sub(Str1,1,(X-1)16+Y-1) = "_")+(G=26)(sub(Str1,1,(X-1)16+Y+1) = "_->Y
X-(G=25)(sub(Str1,1,(X-2)16+Y) ="_")+(G=34)(sub(Str1,1,16X+Y+1) = "_->X
Output(X,Y,"@
End
ClrHome
Stop

I just kinda threw that together, but it should work.  It looks into Str1 to check if the space it is moving to is empty :)
It uses DJ's code, so you can easily modify it to this

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: BASIC movement
« Reply #24 on: February 18, 2012, 12:20:52 pm »
I'll try it out thanks
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: BASIC movement
« Reply #25 on: February 18, 2012, 12:27:34 pm »
my ASCII world use something like that, I think.
However, mine has a 3 walkable tiles :D (And it's kinda slow :\ )
Sig wipe!

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: BASIC movement
« Reply #26 on: February 18, 2012, 12:29:56 pm »
It involves storing 24, 25, 26 and 34 in a list then doing Ξ”list or something for the movement, which is even smaller than my code. It was on TI-BASIC Developer somewhere.

Do you mean Repeat max(K={24,25,26,34}) ?
« Last Edit: February 18, 2012, 12:30:47 pm by BlakPilar »

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: BASIC movement
« Reply #27 on: February 18, 2012, 12:31:05 pm »
my ASCII world use something like that, I think.
However, mine has a 3 walkable tiles :D (And it's kinda slow :\ )

That sounds like more fun to program :P

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: BASIC movement
« Reply #28 on: February 18, 2012, 12:31:45 pm »
it didn't work ???
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: BASIC movement
« Reply #29 on: February 18, 2012, 12:33:09 pm »
which part does it throw errors?
EDIT: maybe G is 45 BEFORE the loops starts. to prevent that, add DelVarG before Repeat G.
« Last Edit: February 18, 2012, 12:34:25 pm by TBO_Yeong »
Sig wipe!