Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (468)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Simple Math Problem  (Read 2478 times)
0 Members and 1 Guest are viewing this topic.
Offline vbrain
« Reply #30 - Posted 2013-04-09 22:38:59 »

Add system.out.println statements to display the value of renderMe after the if statement, and add some in every step of your drawing function to see where things stop.

I added one in the render code and after it, they're always the same. Putting them in the various steps of the render code wouldn't show anything other than true because the render code only runs when renderMe is true.

I know the way that I have everything set up and no matter how I think about this, there should be no reason for this to not be working. It's getting the position of the player, doing some simple math, checking if a few values are higher or lower than others and then changing a boolean. The fact that this isn't working is just weird to me...

I didn't mean print out the value of renderMe.

Put System.out.println("a"), ("b"), ("c"), etc in every step of the game to see what letter it all stops.
Offline cylab

JGO Knight


Medals: 34



« Reply #31 - Posted 2013-04-09 23:50:11 »

Oh people stop that system.out nonsense - learn to use a debugger. You'l solve stuff like this in minutes using one...

Mathias - I Know What [you] Did Last Summer!
Offline tyeeeee1
« Reply #32 - Posted 2013-04-09 23:59:10 »

Oh people stop that system.out nonsense - learn to use a debugger. You'l solve stuff like this in minutes using one...

That is how you debug when the console doesn't show any problems.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 120
Projects: 4
Exp: 3 years



« Reply #33 - Posted 2013-04-10 00:39:50 »

Oh people stop that system.out nonsense - learn to use a debugger. You'l solve stuff like this in minutes using one...

That is how you debug when the console doesn't show any problems.
Actually, you're supposed to use the debugger full-time...with hotswapping the time difference for simple problems is negligible, and you'll save a lot of time with more complex problems.
Offline deepthought
« Reply #34 - Posted 2013-04-10 00:42:46 »



I disabled your culling, and noticed that even though they're practically on top of each other their coordinates are drastically different, and the distance decreases as they get further away Shocked. looks like the player and nonplayer are using different frames of reference or something.  Or your game is trying to make me look really stupid persecutioncomplex.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 120
Projects: 4
Exp: 3 years



« Reply #35 - Posted 2013-04-10 00:49:28 »


What eclipse theme is that?
Offline tyeeeee1
« Reply #36 - Posted 2013-04-10 00:53:59 »

I disabled your culling, and noticed that even though they're practically on top of each other their coordinates are drastically different, and the distance decreases as they get further away Shocked. looks like the player and nonplayer are using different frames of reference or something.  Or your game is trying to make me look really stupid persecutioncomplex.

O.o I noticed something like this in one of the tests last night but I thought the numbers were just wrong or something... I'm going to go check out all of the movement code and that for the player, they should definitely both be moving on the same coordinate system; I can't think of many reasons for them being different but maybe if I add half of the screen's height and width to the +400 & -400, that might just put the coordinates back together properly... The reason for this is that the map and everything on it move around the player who is always at the exact center of the screen.
Offline deepthought
« Reply #37 - Posted 2013-04-10 00:54:39 »

What eclipse theme is that?
my own weird-guy theme. Based partially off the theme from Liberty Basic, partially off the theme from FreeBasic, with a dark blue background for at night and because i happen to like that color.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline tyeeeee1
« Reply #38 - Posted 2013-04-10 00:59:57 »

It looks like my assumption of increasing the amount from 400 to around 1000 seems to have solved everything, now I just need to adjust the number for each direction and it should all work out. I'm not exactly sure if it's solving the problem or just masking it somehow but it seems to be working at the moment.

Edit:
Well... For reasons unknown to me this code somehow works. The numbers don't seem to fit in with anything else but they work. It took a bit of guesswork and a few tries but the numbers are just about perfect.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
// Decides whether to render the sprite or not.
       renderMe = true;
        int x = player.getXLocation();
        int y = player.getYLocation();
       
        if ( xLocation < (x-30) ){
              renderMe = false;
        }
        if ( xLocation > (x+1250) ){
              renderMe = false;
        }
        if ( yLocation < (y-30) ){
              renderMe = false;
        }
        if ( yLocation > (y+1000) ){
              renderMe = false;
        }
Offline deepthought
« Reply #39 - Posted 2013-04-10 01:14:51 »

what I do in openGL (not sure if there's an equivalent in Java2d) is to render everything in it's actual position after setting the transform to the negative player position.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Pages: 1 [2]
  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 (81 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (223 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

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