CasiOo's Profile User Rating: *****

Reputation: 1443 Grandmaster
Group:
Mentors
Active Posts:
3,203 (2.3 per day)
Joined:
05-April 11
Profile Views:
14,648
Last Active:
User is offline Today, 11:35 AM
Currently:
Offline

Previous Fields

Country:
DK
OS Preference:
Who Cares
Favorite Browser:
Opera
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
225
Expert In:
Java

Latest Visitors

Icon   CasiOo has not set their status

Posts I've Made

  1. In Topic: Want to start a project but i'm stuck

    Posted 24 Jan 2015

    If you really are having so much trouble getting started, then maybe you should look into using Scrum's stories, or Use cases from Unified Process
    Then implement one story or use case at a time
  2. In Topic: Want to start a project but i'm stuck

    Posted 24 Jan 2015

    I would heavily advice you to focus on just one thing at a time

    Implementing the business layer, and the GUI are two totally different things, and should be separated
    You are currently talking about doing both at once, which is generally not a good thing

    Start with getting your business logic implemented, when that's ready, you can move on to coding a GUI on top of it :)
  3. In Topic: Sort Java Array with More Than One Value?

    Posted 22 Jan 2015

    First let your object implement the Comparable interface
    Compareable only contains one method, compareTo

    Quote

    a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.


    So first we need to decide in which order we want to compare the fields
    While the compare equal 0, the objects are equal, move on to compare using the next field
    Something like
    int compare = this.name.compareTo(other.name);
    if (compare == 0) compare = this.number - other.number;
    if (compare == 0) compare = this.quantity - other.quantity;
    if (compare == 0) compare = Double.compareTo(this.cost, other.cost);
    return compare;
    
    
  4. In Topic: LibGdx/Box2D How to group tiles into one larger polygon

    Posted 22 Jan 2015

    Please bare in mind that I'm not a game developer
    I have some ideas, untested, but they should work in practice ;)
    I know nothing about this 'body' class in Libgdx, so I haven't focused on them at all

    Libgdx has support for tiled maps, but you don't seem to use it
    It is up to you, if you want to use Libgdx's solution, or if you roll your own. I just wanted to give you a headsup

    -----------

    Every tiled game typically have a mix of different tile types
    Some tiles are collidable, and some are not
    The same goes for other entities on the map

    We first want to separate the collidable types from the non-collidable types
    This way we won't be wasting time doing collision detection against tiles or entities that don't matter
    We'll name the layer/group containing the collidables CollidableLayer ^^

    Whenever we want to get collidables for an area, we will ask the CollidableLayer for them
    This gives us a good abstraction, where we easily later on can change strategy if needed

    So how will the CollidableLayer know which to return?
    Every entity should have a boundingbox. This boundingbox might span multiple tiles
    We only want to check collision against the tiles that are inside the boundingbox
    public CollidableCollection getCollidables(BoundingBox box) {
    	//Collection of every collidable entities (tiles too)
    	CollidableCollection collection = new CollidableCollection();
    	
    	//All of the tiles inside the BoundingBox
    	Tile[] tiles = getTilesBetween(box);
    	
    	//Add them to the collection
    	collection.addFromTiles(tiles);
    	
    	return collection;
    }
    
    private Tile[] getTilesBetween(BoundingBox box) {
    	//Taken, with few modifications, from http://gamedev.stackexchange.com/questions/21650/efficient-tile-based-collision-detection-for-a-lot-of-squares
    	int leftMostTile = (int) Math.Floor((float) box.left / Tile.TILE_WIDTH);
    	int rightMostTile = (int) Math.Ceiling(((float) box.right / Tile.TILE_WIDTH)) - 1;
    	int topMostTile = (int) Math.Floor((float) box.top / Tile.TILE_HEIGHT);
    	int bottomMostTile = (int) Math.Ceiling(((float) box.bottom / Tile.TILE_HEIGHT)) - 1;
    	
    	for (int y = topMostTile; y <= bottomMostTile; y++) {
    		for (int x = leftMostTile, x <= rightMostTile; x++) {
    			//TODO Add them to an array one at a time
    		}
    	}
    	
    	//TODO Return array containing the tiles
    	throw new NotImplementedException("");
    }
    
    


    So now we know what entities to do collision detection against
    How you do collision detection is up to you
    An idea I had right now:
    //Find out what the next move could be, but don't move the player yet
    PlayerMove nextMove = getNextMove();
    BoundingBox nextBoundingBox = nextMove.getBoundingBox();
    
    //Get all the collidables inside the next move's bounding box
    //Sort them ascending to the start position, so the closest collidable is first in the list
    CollidableCollection collidables = collisionLayer.getCollidables(nextBoundingBox)
                                                     .sortByDistance(playerBoundingbox);
    
    for (Collidable collidable : collidables) {
    	boolean collision = this.collisionResolver
    							.entity(this) //Entity resolved for
    							.nextMove(nextMove) //Next entity move
    							.resolveAgainst(collidable) //Resolve against entity
    							.collided(); //If we collided
    					
    	//Stop at first collision
    	if (collision) {
    		break;
    	}
    }
    
    
  5. In Topic: Java blocked in browsers

    Posted 21 Jan 2015

    Go to Control panel > Java
    Set security settings

    Bottom of the general tab it should say: Java in the browser is enabled.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3
Programming Languages:
Java, C#, VB.NET, JavaScript, PL/SQL, PHP (Basic)

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    riperator Icon

    31 Jul 2013 - 10:33
    <3 you
  2. Photo

    b.netana Icon

    23 Mar 2013 - 17:32
    thank*
  3. Photo

    b.netana Icon

    23 Mar 2013 - 17:32
    wanted to that you for your help with my gui practice
  4. Photo

    raghav.naganathan Icon

    25 Nov 2012 - 21:15
    Hi dude...I would like to tell you that your rep(729) is a perfect cube :) Cheers :)
  5. Photo

    ubunta Icon

    30 Sep 2012 - 23:33
    hi hello
    hope will be fine and feeling well!!!!!!!!!!!!!!
  6. Photo

    Proshnobodhok Icon

    12 Oct 2011 - 12:31
    Hi CasiOo,
    I really didnt know the term. nyways seems like you can help me in at least telling me the way to get the related resources. but is it against the IT laws?
  7. Photo

    CasiOo Icon

    28 Jun 2011 - 04:11
    Thank you :)
  8. Photo

    smohd Icon

    26 Jun 2011 - 19:39
    Welcome to contributors group
Page 1 of 1