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

0 Members and 3 Guests are viewing this topic.

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
scrolling and tilemapping tutorial?!?!
« on: January 20, 2012, 09:39:02 pm »
So after finally learning tilemapping, I am finding I can't figure out how to implement scrolling! I wanted to get it so when I started moving right or left the screen moved the opposite direction. but to be honest I don't think my tilemapping is gonna work. so could someone make me a tutorial on a sidescrolling tilemap? And I want this for a platformer jsyk

Thanks :)
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: scrolling and tilemapping tutorial?!?!
« Reply #1 on: January 20, 2012, 09:39:59 pm »
BTW, what platformer are you making?

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 #2 on: January 20, 2012, 09:45:24 pm »
Seeker 2: The Body  OH and this is in axe
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 #3 on: January 21, 2012, 01:25:47 am »
There are plenty of tutorials lying around this site if you can use that search box up there :P

It's a bit difficult for platformers, especially if you want it to run fast, but you'll figure it out ^^

EDIT: I'll start writing a scrolling platformer tutorial if you guys want.
« Last Edit: January 21, 2012, 02:02:47 am by leafiness0 »
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 #4 on: January 21, 2012, 11:36:02 am »
Yeah I did search it but I couldn't find something that made sense, so yeah thanks I'd really appreciate it leafy :)
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: scrolling and tilemapping tutorial?!?!
« Reply #5 on: January 21, 2012, 12:25:18 pm »
check the tutorials section...
at the very bottom, you should be able to see yunhua's tutorial...
it's slightly unoptimized for tutorial purposes, but it should be fine.

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 #6 on: January 21, 2012, 12:47:48 pm »
Yeah I saw that but I didn't understand it much. Plus thats for an RPG and I want one easily fitted for a platformer, I'll check it out again anyways thanks, I might understand it now since the last time I checked it was a month ago before I actually understood tile mapping
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 #7 on: January 21, 2012, 03:22:39 pm »
If your platformer is smooth scrolling with physics, you might have to change the code up quite a bit.  If it uses simple physics, then you can use the same code pretty much, except have a constant gravity.

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 #8 on: January 21, 2012, 03:27:10 pm »
this is my code...can you help modify it to work? and I know the map is small I'll make it larger once i get the scrolling


Code: [Select]
:.TILES
:Full
:Lbl TMAP
:ClrDraw
:[010101010101010101010101]→GDB1
:[010000000000000000000001]
:[010000000000000000000001]
:[010000000000000101010101]
:[010000000000000000000001]
:[010001010100000000000001]
:[010000000000000000000001]
:[010101010101010101010101]
:[7E81A581A599817E]→Pic1
:For(B,0,7)
:For(A,0,11)
:{B*12+A+GDB1}→T
:If T
:T--
:Pt-On(A*8,B*8,T*8+Pic1)
:DispGraph
:End
:End
:End
:[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)
:X--
:2→D
:End
:If getKey(3) and (pxl-Test(X+8,Y+6)=0) and (pxl-Test(X+8,Y+1)=0)
:X++
: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)
:Y--
: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)
:Y++
:0→J
:End
:If getKey(1) and (pxl-Test(X,Y+8)=0) and (pxl-Test(X,Y+8)=0)
:Y++
: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
:End
« Last Edit: January 21, 2012, 03:27:54 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 #9 on: January 21, 2012, 03:31:19 pm »
could you tell me what each of your pointers, not counting the sprite pointers, do?  I'm really bad at understanding other people's code.  :P

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 #10 on: January 21, 2012, 03:34:57 pm »
A is columns and B is rows, J is for jumping, X and Y are for your characters position, and D is just the direction you face
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 #11 on: January 21, 2012, 03:38:12 pm »
In line 50, why do you have pxl-test(X, Y+8) twice?  as for scrolling, I'm working on that right now.  ;)
« Last Edit: January 21, 2012, 03:54:43 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 #12 on: January 21, 2012, 03:45:24 pm »
Just a copy and paste error :P sorry, and THANKS SO MUCH FOR HELPING ME!!!
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: scrolling and tilemapping tutorial?!?!
« Reply #13 on: January 21, 2012, 03:48:18 pm »
On TI-Planet ( here ), a member suggested this :

Quote
Si tu veux faire du tilemapping pixel par pixel, il faut en effet utiliser le smooth scrolling. Je vais essayer de t'expliquer comment faire :
Tout d'abord , tu dois changer de signe deux variables (I et J) en fonction de la direction où tu vas comme ceci :
CODE: TOUT SÉLECTIONNER
:If getKey(3) and (I=0) and (J=0)
:1→I
:End
:If getKey(2) and (I=0) and (J=0)
:-1→I
:End
:If getKey(1) and (I=0) and (J=0)
:1→J
:End
:If getKey(4) and (I=0) and (J=0)
:-1→J
:End


Ensuite tu les ajoutes à H et V (le décalage horizontale et verticale sur la map entre 0 et 8 ) :
CODE: TOUT SÉLECTIONNER
H+I+I→H
V+J+J→V

Lorsque tu as bougé de 8 pixels, tu rajoute (ou soustrait 1) à la position horizontale/verticale (ici P = horizontale et Q = verticale) :
CODE: TOUT SÉLECTIONNER
:If H-8=0 or (H+8=0
:P+I→P
:0→H→I
:End
:If V-8=0 or (V+8=0
:Q+J→Q
:0→V→J
:End


En tout, tu as :
CODE: TOUT SÉLECTIONNER
:Repeat getKey(15)
:
:If getKey(3) and (I=0) and (J=0)
:1→I
:End
:If getKey(2) and (I=0) and (J=0)
:-1→I
:End
:If getKey(1) and (I=0) and (J=0)
:1→J
:End
:If getKey(4) and (I=0) and (J=0)
:-1→J
:End
:
:
:H+I+I→H
:V+J+J→V
:
:If H-8=0 or (H+8=0
:P+I→P
:0→H→I
:End
:If V-8=0 or (V+8=0
:Q+J→Q
:0→V→J
:End
:
:sub(MAP)
:Pt-Off(48,32,Pic1
:DispGraphClrDraw
:End
:Return


sub(MAP) appellera la fonction qui s'occupe d'afficher la map à l'écran et Pic1 contient le sprite du personnage.

Pour voir les tiles sur le bord quand tu te déplace, tu dois avoir préalablement affiché la colonne/ligne d'après/avant.
Voilà maintenant le code de la fonction MAP :
CODE: TOUT SÉLECTIONNER
:Lbl MAP
:For(Y,0,9
:For(X,0,13
:Pt-On(X*8-8-H,Y*8-8-V,{Y+Q*[largeur de la map]+X+P+GDB1}*8+Pic0
:End
:End
:Return

avec GDB1, un pointeur sur la map et Pic0, un pointeur sur les tiles.

En espérant t'avoir aidé.
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 #14 on: January 21, 2012, 03:49:13 pm »
In english?
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES: