I am working on Java games for a few months now and I have a problem.
My I am trying to implement I have the functionality of transition and collision maps, but I know O the collision event to become environment (which is not easily hierarchy code for the collision event). I am familiar with the supervisor pattern, in which Even just ... When More generally: How can I send messages between the two classes without the layers on the layers of the constructor / constructor injection? Have you heard about model-view-controller models? It's nothing, but maybe it can help, basically your program will have three parts: Your controller group may contain arrays / array lists, which are included in all parts that were created during the game, such as collision boxes for each collision box (I I am using an instance variable (maybe by calling this ID) which represents its position in the array (this index can be as simple as an integer). When two boxes collide, you can call a method in the controller class which takes two IDs, and these IDs will easily find where they are in the array. Of course, you can use other data structures, but I hope this will give you the original idea. player runs around a
environment , which contains tiles, in which everyone has their own
CollisionBox Just keep: When
player s
collision box matches any other
collision box (like a box or something like that) , Then the player can not move. That part is taken care of.
Interactive Tile s, in which
player will be caused if something happens to a specific
collision box , especially like stairs or doors, I want to be able to make a new
environment if specific * interactive tile * s hits
environment can "hear" this collision, but I do not really know how it will be implemented here, Or even if this is the right design pattern for this situation!
Player.IsCollidingWithDoorLeadingToNewEnvironment is
environment. New environment for protection ( New Environment) should be called, but they are far apart in code structure from each other.
No comments:
Post a Comment