Skip to main content
gamedev.net
🔒 Locked

map structure in java

Started by vincent_cloudy 3 replies 450+ views
Original Post
vincent_cloudy
vincent_cloudy
i am making a game in java that needs to create a map structure so that the player can move along it. i just have create some class: MapSite //super class of the elements of the map Room extends MapSite Corridor extends MapSite SiteFactory // use to create different elements FullMap //arrayList to store all the rooms and corridors i found it does not have door with the room so that if moving along the rooms, no locked room is found. i want to add a new element "door" to connect the room. but i dunno how to make this. anyone can help me? for the detail of how many rooms can a room can connect to, Room use array[4] // max no of room can connect is 4 corridor use hashtale // no limited
OrangyTang
OrangyTang
Why complicate things with different Room and Corridor classes? Whats the difference between rooms and corridors really? Scrap MapSite and merge it with Corridor in the Room class. Keep your hashtable or arraylist for links between different rooms. Doors should be easy, create yourself a Door class and use it as an intermediate node inbetween Rooms instead of linking then directly.
vincent_cloudy
vincent_cloudy
now i have create new class:-
interface MapSite
Room implements MapSite
Door implements Mapsite
FullMap
SiteFactory

and there is a class called Player, it is used to create a player and with a attribute "curposition" to store which Room player is in.

and i use a jframe to show this with a label
but i found that when my player go to another room, the label cannot be update...just remain the same.
what is is problem??
should i use observer pattern in different panel in order to update when the player do something.?
vincent_cloudy
vincent_cloudy
i am making a 2D adventure game with GUI....

suppose to use full screen, but is it difficult?
like doom or R6 that kind of full screen....

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.