Author Topic: scrolling and tilemapping tutorial?!?!  (Read 10498 times)

0 Members and 1 Guest are viewing this topic.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: scrolling and tilemapping tutorial?!?!
« Reply #15 on: January 21, 2012, 03:50:28 pm »
In english?

Google translate the original topic ?

sorry :/
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

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: scrolling and tilemapping tutorial?!?!
« Reply #16 on: January 21, 2012, 03:51:23 pm »
ok I'll do that... but I still think if yunhua can put it into my code it would be easier for me to understand
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: scrolling and tilemapping tutorial?!?!
« Reply #17 on: January 21, 2012, 03:54:21 pm »
i'm not sure whether this works, if it doesn't could you screenshot it so I can see what's wrong?

Code: [Select]
:.TILES
:Full
:Lbl TMAP
:ClrDraw
:[01010101010101010101010101]→GDB1
:[01000000000000000000000001]
:[01000000000000000000000001]
:[01000000000000010101010101]
:[01000000000000000000000001]
:[01000101010000000000000001]
:[01000000000000000000000001]
:[01010101010101010101010101]
:[7E81A581A599817E]→Pic1
:0→R→C
:[3C429581818D423C]→Pic1MAN
:[003C7E7E7E7E3C00]→Pic2MAN
:[3C42A98181B1423C]→Pic3MAN
:45→X:45→Y:0→J:1→D
:Repeat getKey(15)
:
:Pt-On(X,Y,Pic2MAN)r
:If getKey(2) and (pxl-Test(X-1,Y+6)=0) and (pxl-Test(X-1,Y+1)=0)
:C++
:2→D
:End
:If getKey(3) and (pxl-Test(X+8,Y+6)=0) and (pxl-Test(X+8,Y+1)=0)
:C--
:1→D
:End
:If getKey(4) and (pxl-Test(X+1,Y+8) or pxl-Test(X+7,Y+8)
:18→J
:End
:If (J>0)
:R++
:J--
:End
:If (pxl-Test(X+6,Y+8)=0) and (pxl-Test(X+1,Y+8)=0) and (J=0) or (pxl-Test(X,Y) or (pxl-Test(X+7,Y)
:R--
:0→J
:End
:If getKey(1) and (pxl-Test(X,Y+8)=0)
:R--
:0→J
:End
:If (D=1)
:Pt-Change(X,Y,Pic1MAN)
:End
:If (D=2)
:Pt-Change(X,Y,Pic3MAN)
:End
:Pause 25
:DispGraph
:DispGraphr
:ClrDrawr
:If (D=1)
:Pt-Change(X,Y,Pic1MAN)
:End
:If (D=2)
:Pt-Change(X,Y,Pic3MAN)
:End
:sub(MAP)
:End
:
:Lbl MAP
:For(B,0,9)
:For(A,0,13)
:{B+(R/8)*12+A+(C/8)*8+GDB1}→T
:If T
:T--
:Pt-On(A-1*8+C^8,B-1*8+C^8,T+Pic1)
:DispGraph
:End
:End
:End
« Last Edit: January 21, 2012, 04:12:22 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

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: scrolling and tilemapping tutorial?!?!
« Reply #18 on: January 21, 2012, 03:55:12 pm »
sure, I'll try it out thanks :)
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

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: scrolling and tilemapping tutorial?!?!
« Reply #19 on: January 21, 2012, 04:10:00 pm »
ok so it just drew everything in the top right hand corner I think resulting in a black box in the top corner O.O
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: scrolling and tilemapping tutorial?!?!
« Reply #20 on: January 21, 2012, 04:13:54 pm »
I edited the code in my earlier post.

Change line 67 into what it is now.
Its the 8th row from the bottom, I think, with the part where it stores the stuff into T.
and then in line 70, remove the "*8" in the "T*8"

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

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: scrolling and tilemapping tutorial?!?!
« Reply #21 on: January 21, 2012, 04:17:45 pm »
ok compiling...one sec

edit: same problem...except it I press right then it draws everything down 8 and right 8..resulting in two black boxes
« Last Edit: January 21, 2012, 04:19:02 pm by saintrunner »
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: scrolling and tilemapping tutorial?!?!
« Reply #22 on: January 21, 2012, 04:22:18 pm »
hmm...  I'm not sure what's wrong.  Its hard to do this without a calc sitting in front of me.  :/
I left it at school this weekend.  :o

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

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: scrolling and tilemapping tutorial?!?!
« Reply #23 on: January 21, 2012, 04:25:29 pm »
The problem is defiantly with the tile map drawing :P problem is knowing which part
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: scrolling and tilemapping tutorial?!?!
« Reply #24 on: January 21, 2012, 04:36:07 pm »
changed the map routine.
I really have no idea why it shouldn't display the entire screen though...

Code: [Select]
:.TILES
:Full
:Lbl TMAP
:ClrDraw
:[01010101010101010101010101]→GDB1
:[01000000000000000000000001]
:[01000000000000000000000001]
:[01000000000000010101010101]
:[01000000000000000000000001]
:[01000101010000000000000001]
:[01000000000000000000000001]
:[01010101010101010101010101]
:[7E81A581A599817E]→Pic1
:0→R→C
:[3C429581818D423C]→Pic1MAN
:[003C7E7E7E7E3C00]→Pic2MAN
:[3C42A98181B1423C]→Pic3MAN
:45→X:45→Y:0→J:1→D
:Repeat getKey(15)
:
:Pt-On(X,Y,Pic2MAN)r
:If getKey(2) and (pxl-Test(X-1,Y+6)=0) and (pxl-Test(X-1,Y+1)=0)
:C++
:2→D
:End
:If getKey(3) and (pxl-Test(X+8,Y+6)=0) and (pxl-Test(X+8,Y+1)=0)
:C--
:1→D
:End
:If getKey(4) and (pxl-Test(X+1,Y+8) or pxl-Test(X+7,Y+8)
:18→J
:End
:If (J>0)
:R++
:J--
:End
:If (pxl-Test(X+6,Y+8)=0) and (pxl-Test(X+1,Y+8)=0) and (J=0) or (pxl-Test(X,Y) or (pxl-Test(X+7,Y)
:R--
:0→J
:End
:If getKey(1) and (pxl-Test(X,Y+8)=0)
:R--
:0→J
:End
:If (D=1)
:Pt-Change(X,Y,Pic1MAN)
:End
:If (D=2)
:Pt-Change(X,Y,Pic3MAN)
:End
:Pause 25
:DispGraph
:DispGraphr
:ClrDrawr
:If (D=1)
:Pt-Change(X,Y,Pic1MAN)
:End
:If (D=2)
:Pt-Change(X,Y,Pic3MAN)
:End
:sub(MAP)
:End
:
:Lbl MAP
:For(B,0,9)
:For(A,0,13)
:{B+(R/8)*12+A+(C/8)+GDB1}→T
:If T
:T--
:Pt-On(A*8-8+C^8,B*8-8+R^8,T*8+Pic1)
:End
:End
:DispGraph
:

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

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: scrolling and tilemapping tutorial?!?!
« Reply #25 on: January 21, 2012, 04:46:28 pm »
Nope :P it just draws REALLY SLOW and all in the upper left corner.
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: scrolling and tilemapping tutorial?!?!
« Reply #26 on: January 21, 2012, 04:47:23 pm »
huh.  I'll check it out on my calc later.

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

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: scrolling and tilemapping tutorial?!?!
« Reply #27 on: January 21, 2012, 04:47:48 pm »
ok, thanks for all the help anyways :) I really appreciate it
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: scrolling and tilemapping tutorial?!?!
« Reply #28 on: January 21, 2012, 05:16:41 pm »
Fellas, here is your problem.

Pt-On(A*8-8+C^8,B*8-8+R^8,T*8+Pic1)

This line, near the end. Axe ignores order of operations, so you're really taking that entire mod 8 which returns a value from 0-7. This means that it'll always draw the tile in the same little corner at the top left. Try this:

Pt-On(A*8-8+(C^8),B*8-8+(R^8),T*8+Pic1)
In-progress: Graviter (...)

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: scrolling and tilemapping tutorial?!?!
« Reply #29 on: January 21, 2012, 05:25:12 pm »
OHHH so close! It draws a bunch of random stuff though but his time all over the screen. I think a few numbers are off
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES: