On Wed, 24 Dec 2008, s73v3r wrote:
> Since its not covered in the documentation, what is the proper way to
> create a Rectangle Map Layer in the background that does not scroll?

I've added this to the tiles module docstring:

"""
You have three options for map scrolling:

1. never automatically scroll the map,
2. automatically scroll the map but stop at the map edges, and
3. scroll the map an allow the edge of the map to be displayed.

The first is possibly the easiest since you don't need to use a
ScrollingManager layer. You simple call map.set_view(x, y, w, h) on your
map layer giving the bottom-left corner coordinates and the dimensions
to display. This could be as simple as::

   map.set_view(0, 0, map.px_width, map.px_height)

If you wish to have the map scroll around in response to player
movement the ScrollingManager may be used. It has a concept of "focus"
which is the pixel position of the player's view focus (*usually* the
center of the player sprite itself, but the player may be allowed to
move the view around, or you may move it around for them to highlight
something else in the map). The ScrollingManager is clever enough to
manage many layers of map imagery and handle scaling them.

Two methods are available for setting the map focus:

**set_focus(x, y)**
  Attempt to set the focus to the pixel coordinates given. The map layer(s)
  contained in the ScrollingManager are moved accordingly. If a layer
  would be moved outside of its define px_width, px_height then the
  scrolling is restricted. The resultant restricted focal point is stored
  on the ScrollingManager as manager.fx and manager.fy.

**force_focus(x, y)**
  Force setting the focus to the pixel coordinates given. The map layer(s)
  contained in the ScrollingManager are moved accordingly regardless of
  whether any out-of-bounds cells would be displayed. The .fx and .fy
  attributes are still set, but they'll *always* be set to the supplied
  x and y values.
"""

Hope this helps.


    Richard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to