Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Game Interactables  (Read 232 times)
0 Members and 2 Guests are viewing this topic.
Online SkyAphid

Full Member
**

Posts: 155
Medals: 1



« on: 2012-01-29 15:53:16 »

My game uses tiled, and right now I'm trying to decide how the game will register interactable objects. The game uses separate game states for each location, so I was thinking when the player interacts, it can just check his X and Y accordingly and match it that way, but I want to know if this is the most efficient way of doing it beforehand. What do you guys think?

"God grant me the serenity, to accept the things I cannot change; courage to change the things I can; and wisdom to know the difference."
Offline ReBirth

JGO Wizard
****

Posts: 1272
Medals: 19



« Reply #1 on: 2012-01-29 18:39:52 »

If you map your world in Array of int or else, you can check if the player can interact by seeing their location and check value of the object they want to interact.

Offline gbeebe

Full Member
**

Posts: 145
Medals: 5



« Reply #2 on: 2012-01-29 18:54:56 »

Do you have a class for tiles and interactables?  I'd give the tile class a variable assigned to the interactable class, then if you try to interact, check to see if that tile's interactable is null, if not proceed. 
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.091 seconds with 19 queries.