Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: BlakPilar on February 08, 2012, 04:56:59 pm

Title: Scrolling problem; please help!
Post by: BlakPilar on February 08, 2012, 04:56:59 pm
So I've been working on a (non-smooth-)scrolling engine in my spare time at school and it mostly works the way I want it to so far. When you move in any direction and you're not on the edge of the map, it shows the next block, like in the screenshot (I haven't implemented collision yet). However, as you can tell, it works in every direction but up! D: I haven't gone through and optimized yet, but I'm going to provide the code for the moving bit. I honestly can't tell why it's not working because the code for each conditional is exactly the same. Please help!

Spoiler For moving code:
X and Y are the person's coordinates on-screen, and Z and [theta] are the coordinates of the top-left corner of where I'm displaying the map from.

..MOVING
If getKey(2)
 If X>1
  X--
 Else
  If Z>0
   Z--
  Else
   X-(X!=0)->X
  End
 End
ElseIf getKey(3)
 If X<10
  X++
 Else
  If Z<(W-12
   Z++
  Else
   X+(X!=11)->X
  End
 End
ElseIf getKey(1)
 If Y<6
  Y++
 Else
  If [theta]<(H-8
   [theta]++
  Else
   Y+(Y!=7)->Y
  End
 End
ElseIf getKey(4)
 If Y>0
  Y--
 Else
  If [theta]>0
   [theta]--
  Else
   Y-(Y!=0)->Y
  End
 End
End

EDIT: If need-be, I can provide all of my code. It really has nothing special to it at the moment.
Title: Re: Scrolling problem; please help!
Post by: epic7 on February 08, 2012, 05:02:19 pm
If Y>0?
Should the 0 be more if you want to not go to the edge?
(unless I'm reading the code wrong)

Wait, what's the problem?
Title: Re: Scrolling problem; please help!
Post by: BlakPilar on February 08, 2012, 05:12:22 pm
Yeah, I got it ;D I just needed to change Y>0 to Y>1 lol. Thanks, though!
Title: Re: Scrolling problem; please help!
Post by: thydowulays on February 08, 2012, 05:36:16 pm
I would actually love if you could provide the all the code for this. I want to get a (non-smooth) scrolling tilemapper up for my game Nulled, and this is EXACTLY what I needed. Thanks!
Title: Re: Scrolling problem; please help!
Post by: saintrunner on February 08, 2012, 05:40:46 pm
I'm actually thinking of turning Caedes into a scroller, and your code would help me too :)
Title: Re: Scrolling problem; please help!
Post by: BlakPilar on February 08, 2012, 09:04:03 pm
Woah, sorry guys x.x lol. It's okay now though, I sent it to you both :D
Title: Re: Scrolling problem; please help!
Post by: shmibs on February 08, 2012, 09:04:45 pm
these things have been posted dozens of times before. just try poking around the forums for one.
the axe routines thread (http://ourl.ca/4129) is a great place to start when looking for that type of thing, and a quick forum search yielded these threads(one of which you started yourself, saintrunner):
http://ourl.ca/7512
http://ourl.ca/11302
http://ourl.ca/12349
http://ourl.ca/9188
http://ourl.ca/14065

tilemapping in axe is basically the most asked, and consequently most well documented, routine on this site.
Title: Re: Scrolling problem; please help!
Post by: saintrunner on February 08, 2012, 09:08:26 pm
Yeah, I got a big chunk of a nonsmooth scrolling tilemap done....not smooth though
Title: Re: Scrolling problem; please help!
Post by: shmibs on February 08, 2012, 09:20:00 pm
like i said, look in the routines thread. it has more than one example of smooth scrolling in there. here's one builder posted two years ago(works only for left and right):
http://www.omnimaga.org/index.php?action=dlattach;topic=1532.0;attach=862

and one i posted seven months later(works for all four directions):
http://ourl.ca/4129/122642
Title: Re: Scrolling problem; please help!
Post by: BlakPilar on February 09, 2012, 07:25:48 am
I don't really venture into the routines thread because I want to find things out by myself. When I understood the basic meaning behind yunhua's smooth-scrolling engine, I decided to try my own one and haven't actually gotten around to fiddling around with it until recently (partly because I just finished Inheritance [awesome book, imo]).

Plus most of the mistakes I make are small silly ones and I eventually end up finding them.
Title: Re: Scrolling problem; please help!
Post by: turiqwalrus on February 09, 2012, 11:54:38 am
I don't really venture into the routines thread because I want to find things out by myself.
makes sense. I try to learn stuff by myself as well :D
partly because I just finished Inheritance [awesome book, imo]
agreed!