Games:Example:Summary

From FANG

Jump to: navigation, search


Below are a number of samples which demonstrate some of the elements of the gaming package. The source code from these examples can be combined and modified for creating your own games. Be sure to examine the source code from all of the examples before posting questions to the bulletin board. These examples are designed to provide code examples of most of the frequently used elements in games written using the FANG Engine.

Games-Example-AlarmBeep.jpg

Alarm Beep

Games-Example-Collision.jpg

Collision

Games-Example-DragNDrop.jpg

Drag-n-Drop

Games-Example-FontFinder.gif

Font Finder

Games-Example-Input.jpg

Input

Games-Example-LevelSelect.jpg

Level Select

Games-Example-MapExplore.jpg

Map Explore

Games-Example-MouseLocator.jpg

Mouse Locator

Games-Example-MoveOnGrid.jpg

Move on Grid

Games-Example-Multiplayer.jpg

Multiplayer

200px-Games-Example-Multiview.jpg

Multiview

Games-Example-Navigator.jpg

Navigator

Games-Example-SnapToGrid.jpg

Snap to Grid

Games-Example-SplashScreens.jpg

Splash Screens

Games-Example-SpriteTest.jpg

Sprite Test

Games-Example-Timer.jpg

Timer

Games-Example-TrackerTest.jpg

Transformer Test

Games-Example-TurnBased.gif

Turn Based

Games-Example-StringSpriteExample.png

String Sprite


media.php?f=Games-Example-AlarmBeep.jpg

Alarm Beep by Jam Jenkins

This example demonstrates audio and alarms. An alarm is set up to make a ding sound 1 second after the game is started, and every 3 seconds thereafter. This is the only example with sound.

Source Code: AlarmBeep.java

Click here to run the Alarm Beep example.


media.php?f=Games-Example-Collision.jpg

Collision by Jam Jenkins

This example moves the circle on the left toward the square on the right. When they intersect the circle is made invisible and the square is removed from the canvas.

Source Code: Bullet.java

Click here to run the Collision example.


media.php?f=Games-Example-DragNDrop.jpg

DragNDrop by Neal Ehardt

This program demonstrates how a sprite can be modified to respond to dragging and dropping.

Source Code: DragNDrop.java and Draggable.java

Click here to run the DragNDrop example.


media.php?f=Games-Example-FontFinder.gif

Font Finder by Jam Jenkins

This program lists all the font families available on your computer. Click on the Next and Previous buttons to go to the next or previous page. You can also click and/or drag in the scrollbar at the bottom of the screen to cycle through the font names.

Source Code: FontFinder.java

Click here to run the Font Finder example.


media.php?f=Games-Example-Input.jpg

Input by Jam Jenkins

This example responds to mouse and keyboard input. The StringSprite 'Horiz' tracks the mouse horizontally only. The StringSprite 'Vert' tracks the mouse vertically only, and 'Both' tracks exactly. Pressing the letters 'i', 'j', 'k', and 'm' on the keyboard moves the StringSprite 'Keys' up, left, right, and down respectively.

Source Code: InputLoop.java

Click here to run the Input example.


media.php?f=Games-Example-LevelSelect.jpg

Level Select by Alex Park

Click to jump through different levels instead of going through levels sequentially.

Source Code: LevelSelect.java, Launcher.java, Level1.java

Click here to run the Level Select example.


media.php?f=Games-Example-MapExplore.jpg

Map Explore by Jam Jenkins

This example shows how to use dragging the mouse to move the background. This is the type of interface common in map programs where you click and drag to move the map.

Source Code: MapExplore.java

Click here to run the Map Explore example.


media.php?f=Games-Example-MouseLocator.jpg

Mouse Locator by Jam Jenkins

This example uses the mouse's location to set the location and text of a StringSprite.

Source Code: MouseLocator.java

Click here to run the Mouse Locator example.

Note: This example is currently being updated to use a new version of the FANG Engine.

media.php?f=Games-Example-MoveOnGrid.jpg

Move On Grid by Jam Jenkins

Shows how to move a sprite smoothly between grid locations rather than jumping directly to the new position. Click on a cell and the circle will move to that cell over a 1 second duration. This example is particularly useful for writing turn-based games such as tic-tac-toe, checkers, or chess where there should be a smooth transition when moving game pieces.

Source Code: MoveOnGrid.java, GridTracker.java, Grid.java

Click here to run the Move On Grid example.


media.php?f=Games-Example-Multiplayer.jpg

Multiplayer by Jam Jenkins

This is an example runs a multi-player applet. You will need to open at least two copies of it to see it work. Right click on the image and open the link in a new tab or window. Repeat for as many players as you would like. Under the number of players select 2 or more. Optionally put in a session name. Click on 'Start & Connect Game'. Each screen that comes up will represent a different player in a multi-player game where each player controls his or her own location.

Source Code: Multiplayer.java

Click here to run the Multiplayer example.


media.php?f=Games-Example-Multiview.jpg

Multiview by Jam Jenkins

This is an example runs a multi-player applet. You will need to open at least two copies of it to see it work. Right click on the image and open the link in a new tab or window. Repeat for as many players as you would like. Under the number of players select 2 or more. Optionally put in a session name. Click on 'Start & Connect Game'. Each screen that comes up will represent a different player in a multi-player game where each player controls his or her own location.

Source Code: Multiview.java

Click here to run the Multiview example.


media.php?f=Games-Example-Navigator.jpg

Navigator by Jam Jenkins

If you want to make the mouse control which way you move, this is how you deal with the limitation that the screen is only so big.

Source Code: Navigator.java

Click here to run the Navigator example.


media.php?f=Games-Example-SnapToGrid.jpg

Snap to Grid by Jam Jenkins

Shows how to make snap positions to a grid. As you move your mouse over the cells, the current cell is highlighted in yellow. This example is particularly useful for writing turn-based games such as tic-tac-toe, checkers, or chess.

Source Code: SnapToGrid.java and Grid.java

Click here to run the Snap to Grid example.


media.php?f=Games-Example-SplashScreens.jpg

Splash Screens by Jam Jenkins

This example demonstrates how to make a game come up after a splash screen. This example uses alarms to provide the timing.

Source Code: Splash.java, StartSplash.java, ActualGameLevel.java, GameOverSplash.java

Click here to run the Splash Screens example.


media.php?f=Games-Example-SpriteTest.jpg

Sprite Test by Jam Jenkins

This example simply places a sprite in the middle of the canvas. Use this example to test different sprites you make before adding them to your game.

Source Code: SpriteTest.java, FaceSprite.java, LightSprite.java, StarSprite.java, TriangleSprite.java

Click here to run the Sprite Test example.


media.php?f=Games-Example-Timer.jpg

Timer by Jam Jenkins

This example demonstrates how to implement a timer that counts up in seconds. This example uses an alarm that goes off every second to update the clock.

Source Code: TimerLoop.java

Click here to run the Timer example.


media.php?f=Games-Example-TrackerTest.jpg

Transformer Test by Jam Jenkins

This example applies a transformer to an oval sprite. Use this example to test different transformers you make before addign them to your game.

Source Code: TransformerTest.java

Click here to run the Transformer Test example.


media.php?f=Games-Example-TurnBased.gif

Turn Based by Wade Gordon and Michael Turnell

This example shows how you can make a game in which the players take turns. When each player clicks, it transfers the turn to the next player.

Source Code: TurnBased.java

Click here to run the Turn Based example.


media.php?f=Games-Example-ArcExample.jpg

ArcSpriteExample by Alan Davis

This example shows the basics of how to use the ArcSprite.

Source Code: ArcSpriteExample.java

Click here to run the ArcSpriteExample example.


media.php?f=Games-Example-ImageExample.png

ImageSpriteExample by Alan Davis

This example shows the basics of how to use the ImageSprite.

Source Code: ImageSpriteExample.java

Click here to run the ImageSpriteExample example.


media.php?f=Games-Example-StringSpriteExample.png

StringSpriteExample by Alan Davis

This example shows the basics of how to use the StringSprite.

Source Code: StringSpriteExample.java

Click here to run the StringSpriteExample example.


media.php?f=Games-Example-OvalSpritePic.png

OvalSpriteExample by Alan Davis

This example shows the basics of how to use the OvalSprite.

Source Code: OvalSpriteExample.java

Click here to run the OvalSpriteExample example.


media.php?f=Games-Example-RectangleSpriteExample.png

RectangleSpriteExample by Alan Davis

This example shows the basics of how to use the RectangleSprite.

Source Code: RectangleSpriteExample.java

Click here to run the RectangleSpriteExample example.


media.php?f=Games-Example-CustomStringSprite.png

CustomStringSprite by Alan Davis

This example shows off the ability to create your own font for use in the FANG engine.

Source Code: CustomStringSprite.java

Click here to run the CustomStringSprite example.


media.php?f=Games-Example-PrettyStringSpriteExample.png

PrettyStringSpriteExample by Alan Davis

This example shows the basics of how to use the PrettyStringSprite.

Source Code: PrettyStringSpriteExample.java

Click here to run the PrettyStringSpriteExample example.


media.php?f=Games-Example-OutlineSpriteExample.png

OutlineSpriteExample by Alan Davis

This example shows the basics of how to use the OutlineSprite.

Source Code: OutlineSpriteExample.java

Click here to run the OutlineSpriteExample example.


media.php?f=Games-Example-PieSpriteExample.png

PieSpriteExample by Alan Davis

This example shows the basics of how to use the PieSprite.

Source Code: PieSpriteExample.java

Click here to run the PieSpriteExample example.


media.php?f=Games-Example-PolygonSpriteExample.png

PolygonSpriteExample by Alan Davis

This example shows the basics of how to use the PolygonSprite.

Source Code: PolygonSpriteExample.java

Click here to run the PolygonSpriteExample example.


media.php?f=Games-Example-InputStringFieldExample.png

InputStringFieldExample by Alan Davis

This example shows the basics of how to use the InputStringField.

Source Code: InputStringFieldExample.java

Click here to run the InputStringFieldExample example.


media.php?f=Games-Example-InputStringSpriteExample.png

InputStringSpriteExample by Alan Davis

This example shows the basics of how to use the InputStringSprite.

Source Code: InputStringSpriteExample.java

Click here to run the InputStringSpriteExample example.


media.php?f=Games-Example-LineSpriteExample.png

LineSpriteExample by Jam Jenkins

This example shows the basics of how to use the LineSprite.

Source Code: LineSpriteExample.java

Click here to run the LineSpriteExample example.


media.php?f=Games-Example-CompositeSpriteExample.png

CompositeSpriteExample by Alan Davis

This example shows the basics of how to use the CompositeSprite.

Source Code: CompositeSpriteExample.java

Click here to run the CompositeSpriteExample example.





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter

Games
Games