Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Please help - Making a background for a platformer  (Read 766 times)
0 Members and 1 Guest are viewing this topic.
Offline StonePickaxes

JGO Coder


Medals: 4
Projects: 2


Nathan Kramber


« Posted 2011-12-18 19:11:08 »

In games, the backgrounds are made up of many images (tree, rock, stone, grass, water, etc) pulled from files and placed together to make the background, or the map. HOW do I do this? I'm watching Markus' livestream right now and don't understand how it's done. I really need to know how to do this to make a good game, and can't find a tutorial on the internet. I've seen it done like this in Pitfall 4k-
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
final String S = "  nnnn   nn  nn  nn  nn  nn  nn  nn  nn  nn  nn  nn  nn  "
        + " nnnn     nn     nnn      nn      nn      nn      nn      nn     nnn"
        + "n    nnnn   n   nn      nn      nn   nnnn   nn      nn      nnnnnn  "
        + " nnnn   n   nn      nn     nn      nn       nn  n   nn   nnnn      n"
        + "n     nnn    n nn   n  nn   nnnnnn     nn      nn      nn   nnnnnn  "
        + "nn      nn      nnnnn       nn      nn  n   nn  nnnnn    nnnn   nn  "
        + " n  nn      nnnnn   nn  nn  nn  nn  nn  nn   nnnn   nnnnnn  n    n  "
        + "    nn     nn     nn      nn      nn      nn     nnnn   nn  nn  nn  "
        + "nn   nnnn    nnnn   nn  nn  nn  nn   nnnn    nnnn   nn  nn  nn  nn  "
        + "nn  nn   nnnnn      nn  n   nn   nnnn             nn      nn        "
        + "              nn      nn              nn       nn       nn nnnnnnnnn"
        + "nnnnnnn     nn     nn     nn      nn      nn      nn   n  nn  nnn nn"
        + " nn nnnnnn   nnnn     nn      nn     nnnn   nnnnnn nn nn nnn  nn  n "
        + "  nn      nn      nn   b  bb  bb  bb  bb  bb  bb  bb  bb  bb  bb  bb"
        + "  bbb bb bb bbbbbb                         j       jjjj    jjjjjj  j"
        + "jjjjjj jjjjjjjj                        k       kkkk    kkkkkk  kkkkk"
        + "kk kkkkkkkkooooooo oooooo   oooo     oo    ooooooooooooooo o oooo   "
        + "  oo    ooooooo  oooo o   oo           oooooooooo  ooooo     oo     "
        + "  o                          mmm    mmmmm    mmm      c      ccc    "
        + "cc cc   c   c   c   c   c   c   cc cc    ccc                        "
        + "              m             m m m            m m                    "
        + " ccccc  cccccc ccccccc ccccccc cccccc  ccccc                      m "
        + "           m  m  m          m m m             m              ccccc  "
        + "cccccc ccccccc ccccccc cccccc  ccccc                              m "
        + "            m m m            m m                     lllll  llllll l"
        + "llllll lllllll llllll  lllll                      m            m  m "
        + " m          m m m             m              lllll  llllll lllllll l"
        + "llllll llllll  lllll           fff fff fff fff fff fff lllllll f fff"
        + " f f fff f f fff f lllllll fff fff fff fff fff fff lllllll f fff f f"
        + " fff f f fff f lllllll                                              "
        + "    mmm    mm mm   m   m   m  m  m mm   m  mmmmm m  mmmm     mmmm   "
        + " mm  mm m  m  m                                         mmm    mm mm"
        + "   m   m   m  m    m     m mm   mm mmmmm    mmmm     mmmm m  mm  m m"
        + "    m m          qq qq    qqq      a      qqq    qq qq   qq qq  qq  "
        + " qq qq qqqq qq   qq qqqq qq qq   qq qqq qqq qqq qqq  qqqqq          "
        + "                                            r       rr rrrrrrrr r r "
        + "r rr r r rrrrrrrrrr                                                 "
        + "       r       rrr     r rrr r   r rrr     r rr      rr      rrr r r"
        + " rrrrrrrrrr                                                f        "
        + " kk      kkk       k       kk      kk      k      k     kk     kkkkk"
        + " k qqqqq q kkkkk  kqqqqq  qkkkkkkk                  f        kk     "
        + " kkk       k       kk      kk      k      k     kk     kkkkk  kqqqqq"
        + "  qkkkkk  kqqqqq  qkkkkkkk             d       d       dd      dd   "
        + "  ddd     ddd     dddd   ddddd   eeeee   eeee     ee     bbbb   bbbb"
        + "bb bbb  bbbbb    bb                   aa     aaaa   aa aaa  aaaa a  "
        + "aaaaaa  aa aaa  aaaa a  aaaaaa  aa  aa  a aa a  a aa a  a aa a   a  "
        + "a     aa           nnnn    n  n    n       n    nnnn  n n nnnnn nnn "
        + "                                                                    "
        + "                                    nnn n n n n n n nnn nnn n     n "
        + "n   nnn            nnnn n     nnnn nn nn n n  nnnn n  nn n n  nn n n"
        + "n n            n            nn n nn n  n n  n  n nn              nn "
        + "       nnnn       n   n n n  nn n n nn  n nnn   n nn    n n         "
        + " n   n  nnn  n   n n nnn n n n n n n n n n n       n               n"
        + "nnnnnn n         nnn n n n   n n nnn n n   n n n nnn n            n "
        + "nnn   n n n   n nnn   n   n   n   n                                 "
        + "       nnn n  nn n nn nn n nnnnn n n nnnnn n  n         nnn nnn n n "
        + "  n nnn nnn n n n   nnn nnn                                         "
        + "                                          aa      hh      hh    h   "
        + "    s ss    ssss     ssss     sss     sss     ss     ooo    oooo    "
        + "oo o    o  o    oo o     o o     o o    oo o       o       o       o"
        + "       oo          aa      hh h    hh h    h  h    ss s    ssss    s"
        + "s      ss      ss      ss      ss      oo ooo  oooo oo oooo  o  oo  "
        + " oo                                                           aa    "
        + "  hh      hh      h       ss      ss      ss s    ssss    sss     ss"
        + "      ss      oo      oo      oo      oo      oo      oo      oo    "
        + "  ooo     o       oo              aa      hh      hh      h       ss"
        + "      ss     sss     sss s   sssss   ssss     ss      oo      oo    "
        + "  ooo     ooo     o o   ooo o   o   o   o    oo      o              "
        + "      aa      hh      hh      h       ss      ss      ss      ss    "
        + "  ss      sss     sss     oo      oo      ooo      ooo     o o   ooo"
        + "oo   o o     o o       o       oo             aa      hh      hh    "
        + "  h       ss      ss      ss      ss      sss     sss     ss      oo"
        + "      ooo     oooo    o oo   oo  o   oo o    o  o    o   o   o      "
        + "  o               aa      hh      hh      h       ss      ss     sss"
        + "     sss s   sssss   ssss     ss      oo      ooo    ooooo   oo oo  "
        + "oo   o  oo   o oo    ooo       o                          aa      hh"
        + "      hh      h       ss      ss s   sssss  sssss   s ss    s ss    "
        + "  ss      ooo     oooo oo oo o  ooo  o   oo  oo                     "
        + "                   ";


Help please!

-Nathan


Check out my website!
Offline h3ckboy
« Reply #1 - Posted 2011-12-18 19:19:17 »

umm, I'm not entire sure how you want to do it. but I can tell you that you probably shouldn't use code from a 4k, cause that code won't be veryg ood, it will jus tbe very small.

I would imagine you can just use a big image, and then scroll it across as you move, just like you scroll everything else.
Offline StonePickaxes

JGO Coder


Medals: 4
Projects: 2


Nathan Kramber


« Reply #2 - Posted 2011-12-18 19:32:29 »

My best example is Minecraft; it's just a single dirt image, a single grass image, etc, and they are put together to make the world.

Check out my website!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie
« Reply #3 - Posted 2011-12-18 19:38:46 »

I'm kind of surprised that zeroone didn't use any kind of RLE compression for that map, but then again Pitfall4K looks like a pretty complete port already, so why bother.

You don't use a big image, you simply render tiles in a grid slightly larger than your visible area, and translate slightly in the opposite direction of movement on every draw.  I believe slick2d comes with some demos including a scrolling tile map.

Minecraft is a completely different type of game.  Forget about minecraft.
Offline StonePickaxes

JGO Coder


Medals: 4
Projects: 2


Nathan Kramber


« Reply #4 - Posted 2011-12-18 20:02:24 »

You simply render tiles in a grid slightly larger than your visible area, and translate slightly in the opposite direction of movement on every draw.  I believe slick2d comes with some demos including a scrolling tile map.

How can I do this? Could you at least link me to the example code?

Check out my website!
Offline sproingie
« Reply #5 - Posted 2011-12-18 20:12:04 »

https://bob.newdawnsoftware.com/repos/slick/trunk/Slick/examples/org/newdawn/slick/examples/scroller/Scroller.java

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (15 views)
2014-04-15 18:08:23

BurntPizza (14 views)
2014-04-15 03:46:01

UprightPath (27 views)
2014-04-14 17:39:50

UprightPath (12 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (51 views)
2014-04-10 04:04:31

BurntPizza (110 views)
2014-04-08 23:06:04

tom_mai78101 (211 views)
2014-04-05 13:34:39

trollwarrior1 (179 views)
2014-04-04 12:06:45

CJLetsGame (185 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!