Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (806)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
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  
  Losing pixels in 2D game.  (Read 2179 times)
0 Members and 1 Guest are viewing this topic.
Offline Dreamtime

Junior Devvie


Medals: 1



« Posted 2014-12-13 04:26:18 »

So I have a background that is meant to scroll. The background image is 2000 pixels wide, however when it is drawn to the screen it comes to 1530 pixels wide.

Why is this occurring?

g.drawImage(background, worldPosition.getBgX(), worldPosition.getBgY(), this);

I just realized the window width is 470. But, why is this happening?

Oh and bonus unrelated(kind of) code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public class f**kyou
{

   
   public static void main(String[] args)
   {
      f**kyou f**k = new f**kyou();
     
      int x = f**k.f**kyou();
     
      System.out.println(x);
   }
   
   int f**kyou()
   {
      int h = 2;
      int y = "GWH".hashCode() % 3000;
      int b = "WWI".hashCode() % 3000;
      for (int l = 0; l <= b; l++)
         h = (h ^ l) % y;
      return h;
   }
}


Little did I know how apt the class name was

EDIT: Oh and worldposition.getBgX, etc etc, thats for the scrolling background. So x is update, background scrolls, not sure why length of background is OHHHHH
I think I know what's happening now. Rofl. Thanks.

You know this happens all the time with me. Typing it out really helps me think about it
Offline Rayvolution

« JGO Spiffy Duke »


Medals: 379
Projects: 2
Exp: 2 years


Resident Crazyman


« Reply #1 - Posted 2014-12-13 08:37:13 »

glad we could help?  Clueless

- Raymond "Rayvolution" Doerr.
Retro-Pixel Castles - Now on Steam!
LIVE-STREAMING DEVELOPMENT: http://www.hitbox.tv/rayvolution
Offline trollwarrior1
« Reply #2 - Posted 2014-12-13 08:47:30 »

glad we could help?  Clueless

Give hi'm a medal!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #3 - Posted 2014-12-13 17:12:15 »

Rubber duck debugging in action, people.

Myomyomyo.
Offline MrPizzaCake

Senior Devvie


Medals: 8
Exp: 3 years


Hello, another wonderful human being :)


« Reply #4 - Posted 2014-12-13 17:21:13 »

Eeehm... Wut? Clueless

How am I? Tough question, since emotions are confusing as heck Tongue
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (587 views)
2019-09-04 15:33:17

hadezbladez (5532 views)
2018-11-16 13:46:03

hadezbladez (2410 views)
2018-11-16 13:41:33

hadezbladez (5793 views)
2018-11-16 13:35:35

hadezbladez (1233 views)
2018-11-16 13:32:03

EgonOlsen (4669 views)
2018-06-10 19:43:48

EgonOlsen (5688 views)
2018-06-10 19:43:44

EgonOlsen (3205 views)
2018-06-10 19:43:20

DesertCoockie (4104 views)
2018-05-13 18:23:11

nelsongames (5125 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
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!