Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 05:47:20 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: Scrolling problem; please help! -  (Read 398 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
BlakPilar
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 02:38:22
Date Registered: 16 July, 2011, 02:50:55
Posts: 735


Topic starter
Total Post Ratings: +43

View Profile
« on: 08 February, 2012, 23:56:59 »
0

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! Big frown 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.


* scrolling.gif (161.06 KB, 192x128 - viewed 88 times.)
« Last Edit: 09 February, 2012, 00:00:14 by BlakPilar » Logged
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:47:54
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2172


Total Post Ratings: +122

View Profile
« Reply #1 on: 09 February, 2012, 00:02:19 »
0

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?
« Last Edit: 09 February, 2012, 00:03:44 by epic7 » Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
BlakPilar
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 02:38:22
Date Registered: 16 July, 2011, 02:50:55
Posts: 735


Topic starter
Total Post Ratings: +43

View Profile
« Reply #2 on: 09 February, 2012, 00:12:22 »
0

Yeah, I got it Grin I just needed to change Y>0 to Y>1 lol. Thanks, though!
Logged
thydowulays
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 19 March, 2013, 16:22:53
Date Registered: 02 November, 2011, 04:41:42
Location: Greenville, SC
Posts: 184


Total Post Ratings: +11

View Profile WWW
« Reply #3 on: 09 February, 2012, 00:36:16 »
0

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!
Logged

Current Projects:
-Sparta GUI Library: 25% - Alpha Stage
-Grapher - 75% - Beta Stage *on hiatus



/image/33080.png[/img]
saintrunner
Custom Spriter: You ask it! I'll Make it!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 09 March, 2013, 02:00:40
Date Registered: 27 October, 2011, 21:52:46
Location: Right here....I think?
Posts: 1776


Total Post Ratings: +97

View Profile WWW
« Reply #4 on: 09 February, 2012, 00:40:46 »
0

I'm actually thinking of turning Caedes into a scroller, and your code would help me too Smiley
Logged

My Sprites Thread   :Updated often Smiley for your viewing pleasure

GAMES:
BlakPilar
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 02:38:22
Date Registered: 16 July, 2011, 02:50:55
Posts: 735


Topic starter
Total Post Ratings: +43

View Profile
« Reply #5 on: 09 February, 2012, 04:04:03 »
0

Woah, sorry guys x.x lol. It's okay now though, I sent it to you both Cheesy
Logged
shmibs
bonsai bok choy wiseguy waterboy
Administrator
LV10 31337 u53r (Next: 2000)
*
Online Online

Last Login: Today at 05:31:59
Date Registered: 11 June, 2010, 19:36:15
Location: 89B6
Posts: 1853


Total Post Ratings: +239

View Profile
« Reply #6 on: 09 February, 2012, 04:04:45 »
0

these things have been posted dozens of times before. just try poking around the forums for one.
the axe routines thread 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://www.omnimaga.org/index.php?topic=4915.0
http://www.omnimaga.org/index.php?topic=8705.0
http://www.omnimaga.org/index.php?topic=9752.0
http://www.omnimaga.org/index.php?topic=6591.0
http://www.omnimaga.org/index.php?topic=11468.0

tilemapping in axe is basically the most asked, and consequently most well documented, routine on this site.
Logged



We're not human, are we?
saintrunner
Custom Spriter: You ask it! I'll Make it!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 09 March, 2013, 02:00:40
Date Registered: 27 October, 2011, 21:52:46
Location: Right here....I think?
Posts: 1776


Total Post Ratings: +97

View Profile WWW
« Reply #7 on: 09 February, 2012, 04:08:26 »
0

Yeah, I got a big chunk of a nonsmooth scrolling tilemap done....not smooth though
Logged

My Sprites Thread   :Updated often Smiley for your viewing pleasure

GAMES:
shmibs
bonsai bok choy wiseguy waterboy
Administrator
LV10 31337 u53r (Next: 2000)
*
Online Online

Last Login: Today at 05:31:59
Date Registered: 11 June, 2010, 19:36:15
Location: 89B6
Posts: 1853


Total Post Ratings: +239

View Profile
« Reply #8 on: 09 February, 2012, 04:20:00 »
0

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://www.omnimaga.org/index.php?topic=1532.msg68518#msg68518
« Last Edit: 09 February, 2012, 04:23:07 by shmibs » Logged



We're not human, are we?
BlakPilar
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 20 February, 2013, 02:38:22
Date Registered: 16 July, 2011, 02:50:55
Posts: 735


Topic starter
Total Post Ratings: +43

View Profile
« Reply #9 on: 09 February, 2012, 14:25:48 »
0

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.
Logged
turiqwalrus
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: Yesterday at 23:17:21
Date Registered: 25 November, 2010, 00:38:42
Location: In a shadowed grotto far from the eyes of the world.
Posts: 708


Total Post Ratings: +42

View Profile
« Reply #10 on: 09 February, 2012, 18:54:38 »
0

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 Cheesy
partly because I just finished Inheritance [awesome book, imo]
agreed!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.289 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.