File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes start at different locations on  a map with scrollers Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "start at different locations on  a map with scrollers" Watch "start at different locations on  a map with scrollers" New topic
Author

start at different locations on a map with scrollers

Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
I am creating a game where the player can choose between several different empires. I have a map that is larger than the screen (with scrollers). Right now, the game starts in the upper left corner of the map and the player always has to scroll to his/her base. But I would like to change it, so the game always starts at the base of the empire the player has selected, which can be at any location on the map.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 11642

So, can you explain in detail what it is exactly that you are having problems with?

Is the game a Swing application? Is your question: how to set the scroll bars to a certain position programmatically?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
The game is a swing application and setting the scroll bars to a certain position programmatically is exactly what I want to do. Sorry that I did not express myself clearly enough earlier.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 11642

See The Java Tutorial: How to Use Scroll Panes for a good overview of how scroll panes work and how to use them.

You can scroll a scroll pane to a certain position using the method scrollRectToVisible(...).
Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
Thanks a lot. I will try it out
 
 
subject: start at different locations on a map with scrollers
 
Threads others viewed
Game development books/recommendations
Question about sprite movement
Help with OO design concept
OO design question?
Flex 4 scrollers
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture