Games:Example:Summary
From FANG
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.
Alarm Beep by Jam JenkinsThis 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 |
Collision by Jam JenkinsThis 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 |
DragNDrop by Neal EhardtThis program demonstrates how a sprite can be modified to respond to dragging and dropping. Source Code: DragNDrop.java and Draggable.java |
Font Finder by Jam JenkinsThis 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 |
Input by Jam JenkinsThis 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 |
Level Select by Alex ParkClick to jump through different levels instead of going through levels sequentially. Source Code: LevelSelect.java, Launcher.java, Level1.java |
Map Explore by Jam JenkinsThis 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 |
Mouse Locator by Jam JenkinsThis example uses the mouse's location to set the location and text of a StringSprite. Source Code: MouseLocator.java |
Note: This example is currently being updated to use a new version of the FANG Engine.
Move On Grid by Jam JenkinsShows 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 |
Multiplayer by Jam JenkinsThis 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 |
Multiview by Jam JenkinsThis 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 |
Navigator by Jam JenkinsIf 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 |
Snap to Grid by Jam JenkinsShows 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 |
Splash Screens by Jam JenkinsThis 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 |
Sprite Test by Jam JenkinsThis 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 |
Timer by Jam JenkinsThis 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 |
Transformer Test by Jam JenkinsThis 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 |
Turn Based by Wade Gordon and Michael TurnellThis 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 |
ArcSpriteExample by Alan DavisThis example shows the basics of how to use the ArcSprite. Source Code: ArcSpriteExample.java |
ImageSpriteExample by Alan DavisThis example shows the basics of how to use the ImageSprite. Source Code: ImageSpriteExample.java |
StringSpriteExample by Alan DavisThis example shows the basics of how to use the StringSprite. Source Code: StringSpriteExample.java |
OvalSpriteExample by Alan DavisThis example shows the basics of how to use the OvalSprite. Source Code: OvalSpriteExample.java |
RectangleSpriteExample by Alan DavisThis example shows the basics of how to use the RectangleSprite. Source Code: RectangleSpriteExample.java |
CustomStringSprite by Alan DavisThis example shows off the ability to create your own font for use in the FANG engine. Source Code: CustomStringSprite.java |
PrettyStringSpriteExample by Alan DavisThis example shows the basics of how to use the PrettyStringSprite. Source Code: PrettyStringSpriteExample.java |
OutlineSpriteExample by Alan DavisThis example shows the basics of how to use the OutlineSprite. Source Code: OutlineSpriteExample.java |
PieSpriteExample by Alan DavisThis example shows the basics of how to use the PieSprite. Source Code: PieSpriteExample.java |
PolygonSpriteExample by Alan DavisThis example shows the basics of how to use the PolygonSprite. Source Code: PolygonSpriteExample.java |
InputStringFieldExample by Alan DavisThis example shows the basics of how to use the InputStringField. Source Code: InputStringFieldExample.java |
InputStringSpriteExample by Alan DavisThis example shows the basics of how to use the InputStringSprite. Source Code: InputStringSpriteExample.java |
LineSpriteExample by Jam JenkinsThis example shows the basics of how to use the LineSprite. Source Code: LineSpriteExample.java |
CompositeSpriteExample by Alan DavisThis example shows the basics of how to use the CompositeSprite. Source Code: CompositeSpriteExample.java |
- This page was last modified on 18 April 2010, at 05:02.
- This page has been accessed 9,143 times.
- Privacy policy
- About FANG
- Disclaimers
- Powered by MediaWiki!













































