Nevermind, I seem to have figured out the problem. I was neglecting to change where the tiles were drawn in the render method. Apparantly, that's what the Character uses for collision or something......
Type: Posts; User: Gravity Games
Nevermind, I seem to have figured out the problem. I was neglecting to change where the tiles were drawn in the render method. Apparantly, that's what the Character uses for collision or something......
I'm trying to change the position of the objects represented in the arraylist.
For example:
In the arraylist, I add a tile at x=100, y=100.
Then I move the object in the objects coding to...
Well, I'm trying to affect the arraylist as well as the tiles. How would I do that?
Here's the code:
Level:
package com.gravitygamesinteractive.kylethecaiman;
import java.awt.*;
import java.util.*;
import java.io.File;
From what I can tell, its not actually reading from the individual tiles, but from the tile objects in the arraylist. I'm guessing that fixing this either requires rewriting the level format or...
That worked! The tiles collision is working perfectly now...when the scrolling is disabled. Unfortunately, for some reason when I scroll the tiles graphics up or down, the collision doesn't move with...
I thought that the g.drawRect line is what sets them...
I guess that means the width and height is somehow not being set, I could have sworn that I did in the drawRect for it:
package com.gravitygamesinteractive.kylethecaiman;
import java.awt.*;...
When I pasted your code over mine, it returned this over and over:
com.gravitygamesinteractive.kylethecaiman.Tile[x=192,y=583,width=0,height=0]...
Code with the printlines:
public boolean isCollidingWithFloor(Point pt1, Point pt2){
for(int f=0;f<Level.tile.size();f++){
System.out.println(Level.tile.size());...
When I use the printline, it correctly shows the number of objects in the arraylist, so that's not the problem. The problem surely has to be the line you said earlier, I must be using the wrong...
Level.tile is an arraylist of tile objects, and the size value is the number of tile objects in the arraylist. I'm not sure why its not getting called though, as it is referenced in the tick method.
Yes, as far as I know, that's the problem line. The printline doesn't print anything there either.
Printlining the points returns a very similar list. However, the Level.tile.get(f) doesn't print at all.
Here's all the printline results, including the one that prints the y value of the player:
stageset
scanset
Object: 0 At: 10,40
Object: 1 At: 0,583
Object: 1 At: 16,583
Object: 1 At: 32,583...
Alright, here's the level class:
package com.gravitygamesinteractive.kylethecaiman;
import java.awt.*;
import java.util.*;
import java.io.File;
public class Level {
Nothing I guess. You think that might be the problem, and if so, how would I fix it?
The problem is that the Character object won't stop falling when it touches a ground object. All the printline shows is the y position and that it keeps increasing.
The number keeps going on. Also, for some reason the crash doesn't happen anymore, in case that helps.
I'm trying to get the player object to stop moving vertically when there is a tile object directly underneath it. The object will not only keep falling, but it also winds up throwing an error when it...
Hi, I'm having a little trouble seeing if an object contains a point. Here's my code:
package com.gravitygamesinteractive.kylethecaiman;
import java.awt.*;
import...