Download presentation
Presentation is loading. Please wait.
Published byHanna-Mari Hänninen Modified over 5 years ago
1
MTA-4201 Game Programming Chapter 8 : Scrolling Background & Font
Outline 8.1 Sprite Font 8.2 Type of Scrolling Background 8.3 Tile-based Scrolling Background 8.4 2D Camera Movement D Isometric Map
2
There are Three ways to output text in XNA games:
8.1 Sprite Font There are Three ways to output text in XNA games: Xml based spritefont (For English) To draw text on screen :
3
8.1 Sprite Font The following list of fonts are installed by XNA Game Studio and are redistributable: Kooten.ttf, Linds.ttf, Miramo.ttf, Bold Miramob.ttf, Peric.ttf, Pericl.ttf, Pesca.ttf, Pescab.ttf
4
8.1 Sprite Font
5
(2) Bitmap Font (For English)
(3) Customized Content Pipeline (For Asian Language)
6
8.2 Types of Scrolling Background
Scrolling Background games allow game Developers to present a much larger world To the game player because things could Be outside of the view of the immediate game Screen. Layers of scrolling backgrounds to Improve the quality of the game screens. (1) Side-Scrolling Background (2) Vertical-Scrolling Background (3) Parallax-Scrolling Background
7
8.3 Horizontal / Vertical Scrolling
In the project, add the images, and the library files : Sprite.cs and HorizontallyScrollingBackground.cs . (2) Add the new variable //Create a Horizontally scrolling background HorizontallyScrollingBackground mScrollingBackground; (3) Modify the LoadContent() method to look like this. protected override void LoadContent() { mScrollingBackground = new HorizontallyScrollingBackground(this.GraphicsDevice.Viewport); mScrollingBackground.AddBackground("Background01"); mScrollingBackground.AddBackground("Background02"); mScrollingBackground.AddBackground("Background03"); mScrollingBackground.AddBackground("Background04"); mScrollingBackground.AddBackground("Background05"); // Load the content for the Scrolling background mScrollingBackground.LoadContent(this.Content); }
8
8.3 Horizontal Scrolling (4) Modify the Update() method to look like this. protected override void Update(GameTime gameTime) { //Update the scrolling backround. mScrollingBackground.Update(gameTime, 160, HorizontallyScrollingBackground.HorizontalScrollDirection.Left); } (5) Modify the Draw() method to look like this. spriteBatch.Begin(); // Draw the scrolling background mScrollingBackground.Draw(spriteBatch); spriteBatch.End(); Detailed Explanation of Horizontal Scrolling :
9
8.3 Tile-based Scrolling / Parallax Scrolling
A sprite class is added to provide extra features for the sprite uses in the game.
10
8.3 Tile-based Scrolling / Parallax Scrolling
A sprite class is added to provide extra features for the sprite uses in the game.
11
8.4 2D Camera Movement It supports a large world / level, and the game controls the camera to show proportion of the world.
12
8.5 Isometric View
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.