Www.devoxx4kids.com Greenfoot Workshop Bobby - Snake.

Slides:



Advertisements
Similar presentations
Overloading Having more than one method with the same name is known as overloading. Overloading is legal in Java as long as each version takes different.
Advertisements

Looking inside classes Fields, Constructors & Methods Week 3.
The Point Class public class Point { public double x; public double y; public Point(double x0, double y0) { x = x0; y = y0; } public double distance(Point.
CSCI 160 Midterm Review Rasanjalee DM.
Teaching with Greenfoot
Animation Mrs. C. Furman. Animation  We can animate our crab by switching the image between two pictures.  crab.png and crab2.png.
Wombats Creating Games with Greenfoot The Walker School – Games and Simulations
Creating Classes from Other Classes Chapter 2 Slides by Steve Armstrong LeTourneau University Longview, TX  2007,  Prentice Hall.
Movement. Fixed Movement setLocation (x, y) Makes the crab move to a fixed cell x,y Relative Movement The functions: getX() getY() Fetch the x and y coordinate.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Classes and Objects in Java
Software Development Unit 6.
A Short Introduction to JAVA
Neal Stublen Computer Systems Hardware Display Keyboard Mouse Microphone Memory Chips Microprocessor.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 19 Microsoft’s Approach 1 –.NET Mobile Framework part 2 Rob.
Chapter 5 - Making Music: An On-Screen Piano
Developer Instruments for Android Android ArtfulBits Inc. Oleksandr Kucherenko.
Neal Stublen Overview of.NET Windows Applications Microsoft Windows OS / Intel Platform Windows Application File SystemNetworkDisplay.
GREENFOOT CLUB RESOURCES Brian Cullen – Rossett School
Visual Programming Fall 2012 – FUUAST Topic: Development environment.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Visual Basic .NET BASICS
JAVA JAVA is an object-oriented programming (OOP) language introduced by Sun Microsystems in In the Java programming language: A program is made.
Object Oriented Programming … and other things you need to program in java.
Your First Java Application Chapter 2. 2 Program Concepts Modern object-oriented programs help us build models to manage the complexity found in a problem.
Debugging. 2 © 2003, Espirity Inc. Module Road Map 1.Eclipse Debugging  Debug Perspective  Debug Session  Breakpoint  Debug Views  Breakpoint Types.
CSC 205 Java Programming II Polymorphism. Topics Polymorphism The principle of substitution Dynamic binding Object type casting Abstract class The canonical.
Mobile Device Programming
Android Boot Camp for Developers Using Java, 3E
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Introduction to Computer Operating Systems
Three main types of computer operating systems By Chloe Monks.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
Using Objects 1 of 22 Computer Programming Object Classes.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Applets Java code is compiled into byte code instead of machine language –Languages like C, C++, Pascal and others are compiled into machine language so.
(c) University of Washington02-1 CSC 143 Java Object and Class Relationships: Interfaces Reading: Ch. 9 (on Java interfaces)
Lecture 1: Network Operating Systems (NOS) An Introduction.
CS288 Object-Oriented Software Engineering Motivation and Introduction Bill Mitchell.
1NetBeans Tutorial Using the “Properties” menu, name the List “List1” and the button “Button1”. NetBeans Tutorial6.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
Creating Scenarios In Greenfoot. Greenfoot Scenarios are made up of: Greenfoot Scenarios are made up of: A World class. A World class. Actor classes.
System Programming Basics Cha#2 H.M.Bilal. Operating Systems An operating system is the software on a computer that manages the way different programs.
This computer science resource was developed through a collaboration between IBM Corporation and CSTA. 1 Lesson 2: Pong Class Design.
CNKI 知识网络发现平台. 我们有许多需求 …… 检索结果不满意 找不到产品入口 很多功能我没 有发现 非专业读者没有 专业使用技巧 我想可视化 查看图表 要在线 浏览! 求分享 ! CNKI 都有什么 要更专业的分析!
Your Host & Speaker Shahed Chowdhuri Sr. Technical Microsoft Technology Areas Enterprise Web/Software Development Game Development Mobile.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Chapter 4 - Finishing the Crab Game
Greenfoot.
ITC 4 ESO 3rd TERM Operating Systems YEAR
Introduction to Programming
Chapter 4 - Finishing the Crab Game
Table of Contents Class Objects.
Introduction to Object-oriented Program Design
Unit 20 – Computer Game Platforms & Technology – Software Technology
زبان بدن Body Language.
Building Java Programs
The Little Crab Scenario
Your First Java Application
Unit 20 – Computer Game Platforms & Technology – Software Technology
1.
Methods, Data and Data Types
Dr. R Z Khan Handout-3 Classes
MULTIPLICATION.
ITE “A” GROUP 2 ENCAPSULATION.
Presentation transcript:

Greenfoot Workshop Bobby - Snake

Greenfoot Development Environment based on the Java programming language. Mainly designed to ease the Java language learning Allow to easily create 2D games Greenfoot is freely available on Microsoft Windows, Mac OS X, and Linux.

The Java language « Object Oriented » Language One of the World’s most used programming language Allow to develop applications running on multiple systems – Windows, Mac, Linux, Android, …

« Object Oriented » Java applications are made of « Objects » Each Object is composed of two main parts: – A set of internal properties – its « behavior », the actions it can do

Classes and Objects To describe an object, we will define a class. A class is a kind of « model » allowing to build the objects – We also say that the objects are « instances » of the class

public class GameElement { private int x; private int y; public GameElement(int initX, int initY) { x = initX; y = initY; } public int getX() { return x; } public int getY() { return y; } public void move(int xMove, int yMove) { x = x + xMove; y = y + yMove; } A Java Class sample

Bobby-Snake 7

New scenario 8

World creation 9

Snake World 10

SnakeWorld code 11

Inspect World 12

Change the code We will use blocks of 32x32 pixels The game size will be 25 x 20 blocks 13

Create a Block 14

Create the Border 15

Coordinates 16 (0,0)(1,0)(2,0)… (24,0) (0,1)(1,1)(2,1)… (24,1) (0,2)(1,2)(2,2)… (24,2) ………… … (0,19)(1,19)(2,19)…(24,19)

Display the borders 17

for loops 18 for ( initialization ; test ; post-processing ) { body ; }

The game borders 19

Class SnakeBody 20

SnakeWorld changes 21

Movement 22

If Statement 23

Limit the Snake size 24

Change of direction 25

Manage collisions (1) 26

Manage collisions (2) 27

Add Apples (1) 28

Add Apples (2) 29

Collision with an apple 30

Add sounds 31

Congratulations! You have completed your first Greenfoot game! You can now start to add new features in your game or start creating new games ! 32