P4Games at Montbello

Game State Step 1

Create a simple game with one keyboard-controlled sprite and one object to capture.  The win condition is the player must move their sprite into the other object.  When the player hits the other object they win.  Make this game have a splash screen, a win screen, and a lose screen.  The transition between these screens is to be controlled by the world class variable "gameState" and the code to make the transitions should be found in the World's act( ) method.  See game7 for example code.

Assignments

Here is a list of programming assignments.

 

  •   GameState Step1. Goal: to learn how to write the code that drives game state changes.
  • GameState Step2. Goal: to learn how to write the code that drives game state changes.
  • Animation.  Goal: to learn how to support multiple levels with game states.

 

Scenario Examples

Programming Text (2008)

This page has (will have) all the programming chapters attached.  

Text Object Class

import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
//Added to allow text...
import java.awt.*;
/**
* Write a description of class EndGameScreen here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class TextObject extends Actor
{
private int length;
private String currentText ;

public TextObject(String text)
{
// setImage("rect.png") ;
// getImage().scale(55,25) ;
int fontSize = 14;

Book08

The latest version of the book.

 

Here are links to some sample video tutorials.  Note, they are referenced in the

yellow boxes in chapter 1 of the book.  Chapter 1 is attached in .doc format.

Programming

Computer Programming   

Syndicate content