What is the best way to test for collisions between objects?

I am in the process of developing my first game, my first decent game that is. I understand how to develop the background and tileset for the game, but have yet to figure out an effective way of testing for collisions. As in you try to move the character into a wall, or another object on the level.
If I divide the level into tiles, it won't be to hard, but I am thinking I want to have the hero be able to move all over the place, not just from square to square.
Any suggestions or ideas will be greatly appreciated

If I divide the level into tiles, it won't be to hard,
but I am thinking I want to have the hero be able to
move all over the place, not just from square to
square.Err...
So if the hero is not on a square, the hero is not on a tile and consequently is not on a visible aspect of the game world?
I suspect that you wanted the hero to be able to move in any direction, not just the standard cardinal directions.
If you're using tiles to represent the game world, then the solution is simple - check to see if there's anything "solid" already on the target tile. If there is, abort the move and report it as a collision. If there isn't, permit the move.
It's only when you have a tile-less world that you actually have to determine if the leading edge of your hero crosses the boundary of an item (or border) that he shouldn't be allowed to cross. Doing so is complicated enough that I would simply suggest that you search the forum for third party collision detection packages that you can borrow.

Similar Messages

  • What is the best way to prepare for CERTIFICATION?

    what is the best way to prepare for CERTIFICATION?
    what is needed?
    where can i read more about it?

    Hi,
    Do as much as possible exercises based on your course material(which will be more than enough).
    If you know (some) Java and have understand the basics of OOP then this is enough for the exam.
    And do not forget:
    it is a multiple-choice test meaning that you see the possible answers.
    Either a single answer is correct (then you will have radio-buttons) or several answers are correct
    (then you will have checkboxes; in this case almost all questions will have more than one correct answer).
    You can refer to the topics for the certification
    https://websmp102.sap-ag.de/~sapidp/011000358700000499112003E
    Some links which might help
    /message/213564#213564 [original link is broken]
    /message/514469#514469 [original link is broken]
    /message/1315746#1315746 [original link is broken]
    /message/1736299#1736299 [original link is broken]
    /message/1736299#1736299 [original link is broken]
    /message/257122#257122 [original link is broken]
    /message/130164#130164 [original link is broken]
    /message/1916905#1916905 [original link is broken]
    /thread/167254 [original link is broken]
    /message/213564#213564 [original link is broken]
    /message/1315746#1315746 [original link is broken]
    <b>
    you try www.sapdoamin.com
    They provide Certification simulation questions which are veryuseful and a must try site.</b>
    Yes more questions comes on OOPS so get your OOPS concepts very clear.
    You don't need to do extensive coding in OOPS.
    Just get the concepts clear and i am sure the certification will be a cake walkthrough.
    All the best and good luck with your ABAP Accreditation.

  • What would the best way to go for an virtual grid?

    I need a 3 x 8 virtual grid that I can change values to:
    Red
    Blue
    Spoiler
    what would the best way to go for this objective?
    Thanks!

    I need a 3 x 8 virtual grid that I can changevalues
    to:
    Red
    Blue
    Spoiler
    what would the best way to go for this objective?
    Thanks!Create a Grid and a Tile class. A
    Grid has a 2D array of Tile objects an
    a Tile has an attribute called Color and, say,
    an x- and y-point. Program some appropriate methods.
    Done.
    Thanks for trying, but Nanook already gave the correct answer in reply 1.Is it possible to restrict these? to like a 8 x 3 grid ?
    or should i use an if statement?

  • What is the best way to export for use on internet?

    what is the best way to export for use on internet?

    It depends. Is this for a personal web site or for a site like YouTube, Vimeo or Facebook?
    For YouTube, Vimeo and Facebook, use Publish & Share/Computer/AVCHD using one of the YouTube presets.

  • What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide
    object ID generator?Always use 3 because it is prime.
    Alternatively more information about the system and the needs of the system might prompt alternative ideas some of which are likely to be better than others for your particular implementation and system constraints.

  • What is the Best way to move large mailboxes between datacenters?

    What is the Best way to move large mailboxes between datacenters?

    Hi, 
     Are you asking with regards to on-premises Exchange? With Microsoft Online SaaS services (aka Exchange Online) there is no control and no need to control which data center a mailbox resides in.
     With regard to on-premises Exchange, you have two choices: you can move it over the WAN in which case you would either do a native mailbox move (assuming you have Exchange 2010 or later you can suspend the move after the copy so you can control the
    time of the cutover) or create a database copy in the second data center and once the database copies have synchronized change the active copy.
    The other choice is to move is out of band which would usually involve an offline seed of the database (you could conceivably move via PST file but that would disrupt access to the mailbox and is not really the 'best way').
    In general, Exchange on-premises questions are best asked on the Exchange forum: http://social.technet.microsoft.com/Forums/office/en-US/home?category=exchangeserver
    Thanks,
    Guy 

  • What's the best way to export for print?

    I usually upload images to my local photoprinting shop. What's the best way to do that with Lightroom? Since lightroom does the final sharpening in the print module, how do I get that into the exported file since there is no export function in the print module? Also, how do I get the proper dpi and sizing info into the photo for the print shop? Thanks.

    There is no good way to prepare images for printing from a file from a commercial printer by using Lightroom alone. You need to do an export of the image without any resizing or color space conversion, and then use some other program of your choice to 'finish' the file.
    It's just plain missing functionality... Lightroom assumes that you will be printing photos yourself and it is missing a whole lot of stuff in order to support external printing, including:
    a) Resize to exact pixel dimensions. Many labs require an exact pixel count for a given print size, so for example for an 8x10 they need a 2400 x 3000 pixel image. Can't be done in Lightroom.
    b) Trim adjustment. If you are doing full bleed photos (no margin), you might need to provide about 0.05 inch of 'trim space' to compensate for image loss during printing. Can't be done in Lightroom.
    c) Exporting to a specific printer profile. Can't be done.
    d) Adding margins, text, etc. Many times my clients want a 1/4 inch margin in their photos to facilitate framing, or I put a dim watermark type text in the bottom corner. Can't be done.
    My solution. Do most processing in Lightroom, do an export, and then do a second export via qImage on a PC. It does all of the above plus much more. It's just a matter of using the right tool for the job, and LIghtroom has no facilities at all for printing to a file.
    I have been asking for "Print to File" ever since I was under NDA during the betas.

  • What is the best way to test connection keys?

    I've created multiple connection key for various rolse on a
    new site. When I select the key it asks if I want to replace the
    existing connection, which I really don't want to do.
    What is the best way to handle this so the administrative
    connection is not affected?

    Also create a connection key for you administrator role, so
    you can swiftly switch back.

  • What is the best way to share for large projection?

    I would like embed my movie as part of the Powerpoint to be shown on a Windows machine (my only option). What is the best way to share it so that it doesn't look grainy or pixelated?

    Fool proof? Does Mircosoft make Powerpoint?
    LOL... but seriously
    You could export it out to a Windows Media file.
    http://www.Flip4Mac.com

  • What's the best way to print content of javax Object (JTable for example)?

    Hi there,
    1) I would like to know the best way to print content of jtable (for example)
    2) I would like to know how can I Print content of SQL statment (for example "SELECT ID, NAME FROM COMPANY")?
    Best Regard,
    Eyal
    [email protected]

    Depends on what you want printed. You can do something like System.out.println(myTable);but you may not like what you see. If you want to print anything else, extend JTable and create a new toString() method that prints out what you want.
    As for printing a SQL statement - assuming it is in a String, you can just do System.out.println(mySQLStatement);

  • What is the best way to share Address book between 5 Macs that are networked?

    We have 5 Macs in the office, using 10.6.x or higher, and linked by a network. One Mac has the company database, and needs to be viewed and updated by the other users. What is the simplest way of doing this?

    Oh, I meant Leopard does do more than Tiger Server.
    I don't know enough about Server, even less abut Syncing.
    SL is to new, not enough time to iron out the kinks yet imho.
    One day SL will be better than Leo, but...
    I'd ask over in server...
    http://discussions.apple.com/category.jspa?categoryID=96
    Or perhaps Collaboration Services...
    http://discussions.apple.com/forum.jspa?forumID=1352
    They may even have a different opinion on SL.

  • What is the best way to Query for a PXI Chassis in TestStand

    Hi All,
    I have some benches that have a PXI Chassis and others without. 
    I would like to Query for the Chassis and if it isn't there I will use another method of testing.
    Is there a way to query for the chassis and if there is how?
    Thanks
    Message Edited by glennjammin on 10-09-2009 09:23 AM
    Test Engineer
    L-3 Communications
    Solved!
    Go to Solution.

    Hi,
    You could use the VISA Find Resource function. If you get back PXI[bus]::device[::function][::INSTR] or PXI[interface]::[bus-]device[.function][::INSTR] then you have a PXI chassis
    regards
    Ray Farmer
    Regards
    Ray Farmer

  • What is the best way of testing a custom web service

    We have a custom developed service (a jar sitting in the xmlpserver/WEB-INF/lib folder) on the BI Publisher server. This service uses the BookBinder class to concatenate some documents.
    We call this service through Axis (PublicReportService_v11) from a 3rd party application, passing in all the details to complete the call.
    I inherited this peace of code and now I need to build some kind of automated test to make sure the service is properly tested. We are using version 10.1.3.4.1.
    I started writing a Java application to send requests but I'm not too sure how to call our custom service. The code looks something like this:
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import javax.xml.namespace.QName;
    public class Test_Web_Service
    public static void main(String [] args) throws Exception {
    try {
    String endpoint = "http://bipserver:port/xmlpserver/services/PublicReportService_v11";
    Service service = new Service();
    Call call= (Call) service.createCall();
    call.setProperty( call.USERNAME_PROPERTY, "bob" );
    call.setProperty( call.SPASSWORD_PROPERTY, "pw");
    call.setTargetEndpointAddress( new java.net.URL(endpoint) );
    call.setOperationName(new QName("http://bipserver:port/xmlpserver/services/PublicReportService_v11","myCustomService"));
    String ret = (String) call.invoke( new Object[] {""} );
    System.out.println("Sent '20', got '" + ret + "'");
    } catch (Exception e) {
    System.err.println(e.toString());
    I'm getting a NullPointerException.
    Edited by: user612544 on 28-Feb-2013 07:13

    I'd recommend a tool like SoapUI (http://www.soapui.org/) - the basic version is free and probably all you'll need.
    Barry Goodsell.
    Please mark as answered if helpful

  • What's the best way to share JE environments between servlets?

    Hi, I'm happily serving requests for the same webapp (so single servlet) which uses multiple JE environments. In my case I have an environment for each db, one of these environments is a login details only db. Things work great, three questions though:
    1. Right now I'm keeping environment/entity store references in global vars (everything below entity store, views etc. is created and discarded for each request), is there a better way?
    2. When I want to add a new app (so additional servlet) - how can I make sure the login environment is shared across servlets, to take advantage of shared cache etc?
    3. As indexes are thread safe, is it considered best practice to store index refs. in global vars. and have each incoming thread (in a servlet) share these vars. or should each request build the object refs. it uses and discard accordingly?
    Hoping the above makes sense.
    PhilQ.

    Yes, EntityIndex objects are also thread-safe. Really only EntityCursor objects are not.
    The entity objects themselves are not owned by JE. You will have problems if you have multiple threads changing them concurrently (if one thread is changing an entity object's properties and another thread is storing it, for example). However, it is up to you if you want to share entity objects between threads; there is nothing wrong with that, since there is no interaction with JE. But your app will need to enforce thread safety, perhaps by using them only in a read-only fashion, for example.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Cloud Newbie: What is the best way to sync content files between locations?

    Not new to Dreamweaver, but am new to the Creative Cloud.  I typically carry an external drive with my web files and update site from home or work computer using those files.  Now that I'm using Dreamweaver CC, I'm trying to find the most efficient way to sync content files between computers.  I see that the "Sync Settings" allows for syncing of preferences - but not content. Anyone have a recommendation? Or do I simply make my changes at work. Then go home and download the page I made changes to update my home files?
    Thanks,
    George

    The Cloud isn't going to synch your site files between 2 computers.  That's not what it's for.
    You might want to explore file check-in/out feature in DW. 
    http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7ebfa .html
    This lets you check files in/out from your Remote server.  That way, you know you're working on the lastest copy. Check-in/out is typically used in collaborative environments where 2 or more people work on the site.  But it might serve your needs as well.
    Nancy O.

Maybe you are looking for

  • IPod Restore Error 1429

    After updating to iTunes 7.0.2, now unable to update songs to iPod click wheel (40GB). After repeated 5 R's, all RESTORE attempts eventually end with "iPod unable to restore due to error (1429)." - Battery appears to be charging and holding charge--n

  • SQL Server Compact 3.5 Save Binary Data to Table

    Hi,    I have successfully saved images to an 'image' type column in SQL Server CE 3.5, I can also retrieve the image back from the table to a file. How can I save any file type e.g. PDF, txt, Doc, DWG etc to an SQL Server CE 3.5 table & retrieve it

  • ITunes / iPod touch not syncing correctly

    I'm having two problems at the moment, the first of which is an error which comes up while syncing the mail accounts to my iPod. The following message (http://www.moventouch.com/itunes.png) comes up (the part which has been blanked out contained my n

  • Supervisor desktop:- Display current skill

    Hi All, In supervisor desktop application, i would like to know, when an agent is in talking mode, the current skill to which he is actually mapped to. a sample code for the same would be of great appreciation. Regards Suhas

  • Address Book's entries have disappeared - all except two

    Hello everyone. I'm hoping that members might be able to offer me some advice about a problem I'm having with Address Book. I use an intel iMac running OS 10.4.11 and Address Book 4.0.6. This morning I used iSync to synchronise my Palm TX with the iM