Copyright © 2005, Richard A. DeVenezia. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.

Slides:



Advertisements
Similar presentations
Sprite-visual object (actor on the stage) Scripts- Tells actors (sprites) what to do.
Advertisements

Create a Simple Game in Scratch
Using Context Sensitive Menus to Enter Values in a SAS/AF Data Table Object Richard A. DeVenezia.
Create a Simple Game in Scratch
MS® PowerPoint.
Threads, Surface Views and Real-Time Games. Background Most of the Android apps we’ve covered so far have been single threaded – And Event driven – An.
Copyright © 2010, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Tetris – Genetic Algorithm Presented by, Jeethan & Jun.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Flash animation For beginners. Lesson objectives To understand how to animate a ball To understand how to loop animations To learn how to use animation.
Harry Potter Scratch Game
Right-click on the colored box and remove it.
A Tutorial by Aaron Price
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Windows 8 Windows Phone 8 Web Mobile … and WakeUpAndCode.com.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Controls General Discussion. VB Controls Visual Basic Controls A control is the generic name for any object placed on a form Controls may be images,
Learning. Microwave office Creators: Iman Radmanesh Amin Fehresti-sani.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Animating and Using Multimedia Effects Lesson 10.
Creating Mobile Apps with App Inventor! Day 5 Google search Kris Gordon Ludlow for links.
Line up By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Statistical Discovery. TM From SAS. JMP ® Software: Introduction to Categorical Data Analysis.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
Web Technologies Website Development Trade & Industrial Education
Using FrontPage Express. Slide 1 Standard toolbars and menus Time indicator: gives an approximation of download time of the page.
McGraw-Hill Career Education© 2008 by the McGraw-Hill Companies, Inc. All Rights Reserved. 2-1 Office PowerPoint 2007 Lab 2 Modifying and Refining a Presentation.
Copyright © 2002, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Copyright © 2004, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Robotics Overview of NXT-G Actuators in Mindstorms. Touch sensor Labwork: Right turn. Touch/bump. [Explore move versus Motor Move mini & motor mini. Motor*.]
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
 2002 Prentice Hall, Inc. All rights reserved Introduction Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides.
Team 22 沈昇勳、李宗儒、洪銘駿. Among EE students, one particular game is especially popular and has many devoted players: LUMINES. FOREWORDS.
PowerPoint Practice Exercise 1 1.Save this file in your AV-TECH Folder as PowerPoint Practice Exercise 1. 2.Open this file in PowerPoint. 3.Edit each slide.
Chapter 22 The Smooth Motion: Case Study in Algorithmic Solving.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Bike and Hike Skills: Graphics, Image Maps, Photo Galleries, Layers.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Game Maker Galactic Mail Advanced Group: Complete Galactic Mail, then start developing an independent project.
Copyright © 2005, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Flash animation For beginners. homework Your homework is over two weeks so please write in each week of your planner for the next two weeks For homework.
© 2011 Autodesk Importing the Most Useful Data Into Survey in AutoCAD Civil 3D 2012 Russ Nicloy Civil Applications Engineer.
1 Mouse Events See Figure See Example in Figure 11.28,
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
How to create a basic game in Scratch. The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high x increasesx decreases.
PyGame - Unit 1 PyGame Unit – – Introduction to PyGame.
Flag Quiz Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
A gentle introduction to Bootstrap TDAP Jeremy Shafer Department of MIS Fox School of Business Temple University Spring
Microsoft Office 2007-Illustrated
Microsoft Access 2007 – Level 2
PYGAME.
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
A brief introduction to the topic
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
The Game of Tetris Project Classic Game Play Hardware New Features
Flash animation For beginners.
Module 2.2 COP4600 – Operating Systems Richard Newman
More examples How many processes does this piece of code create?
Animated picture collection: left picture moves to front center
The Smooth Motion: Case Study in Algorithmic Solving
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Presentation transcript:

Copyright © 2005, Richard A. DeVenezia. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or Trademarks of their respective companies. Slide imagery Copyright © 2005, SAS Institute Inc. All rights reserved. Tetris: SAS/AF Considerations Richard A. DeVenezia Independent Consultant

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Overview n SAS/AF - Dead or Alive ? Built to last n Gaming Tradition

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Tradition

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Topics to be Covered n Invention n Pieces n Game Play n Movement Keys n Layout n Timing Loop

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Inventor n Alexey Pajitnov n 1985 n World wide craze More dangerous than a Rubik’s Cube n Still popular

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Pieces n Arrangement of four squares or blocks Seven shapes

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Drawing a block n DATA Step - DSGI n 45 degree lines left side, then bottom side color varies by linear interpolation

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Saving a block n goptions device=GIF xpixels=30 ypixels=30; n rc = graph (‘CLEAR’, “E”); rc = gset ('COLREP', cindex, acolor); rc = gset ('LINCOLOR', cindex); rc = gdraw ('LINE', 2, x1,x2, y1,y2);... rc = graph (‘UPDATE’); * creates E.GIF; n PIECE.CLASS uses 4 block images

Copyright © 2005, Richard A. DeVenezia. All rights reserved..GIF to.IMAGE sashelp.fsp.imgdat Image Data Model _readFilePath(file) _writeCatalog(ent) n Images in same catalog as game

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Game Play n Pieces drop by gravity n Player can move, rotate or drop pieces Within the grid n Can’t move? Locked piece Check for completed rows n Game over? Any part of locked piece outside the grid

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Piece Class n Adapts to piece type A,B,C,... arrays define geometry private num D [ 4, 3, 3 ] / ( initialValue = {.,.,., 1, 2, 3,.,., 4,., 1,.,., 2,., 4, 3,., 4,.,., 3, 2, 1,.,.,.,., 3, 4,., 2,.,., 1,. }); n One array per piece 4 states of rotation 4 blocks per piece values define block layout 1, 2, 3 4 1, 2, 3, 4, 3, 2, 1 4, 4 3, 2, 1,

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Piece Class - attributes Track state block[4]- image viewers field- grid (locked blocks) piece- A,B,C... state- rotation state 1..4 side- dimension of side (px) gravity- how much to drop (px) timeout- when gravity next occurs baseSleep - event checking interval x,y,row,col - position of piece on field n Where, when, how, what is going on

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Piece Class - methods Attribute driven methods setcam* - x,y,row,col Behaviors right - move blocks of piece left down drop rotate lock Misc blockRowOf(y), topOfRow(n) - support geometry tests

Copyright © 2005, Richard A. DeVenezia. All rights reserved. HOLD ON, WAIT a SECOND! n Piece.wait() Important and essential Wait for player to do something n Does what needs doing while the player does nothing Drop a little (gravity) Play a blip sound

Copyright © 2005, Richard A. DeVenezia. All rights reserved. I’m Waiting... n EVENT() returns 1 when the player stops doing nothing n SLEEP() yields gracefully, but unresponding

Copyright © 2005, Richard A. DeVenezia. All rights reserved. The Waiting Game wait: method return=num dt = datetime(); do until EVENT(); do while (dt =timeout) then do;... move down, play sound, timeout+X... return 1 if locked, -1 if game over end; end; return 0; * event needs servicing;

Copyright © 2005, Richard A. DeVenezia. All rights reserved. What caused the event? n A Text Entry Control Field where user types in left rotate right 2 drop n Has overrides kbd.keyFeedback = ‘Yes’ kbd. _setInstanceMethod ('_onKey', 'Playmethods', 'onkey');

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Playmethods.scl:onKey n Dispatches keypress handlers piece = _self_.piece; select (upcase(_self_.text)); when ('4') piece.left(); when ('5') piece.rotate(); when ('6') piece.right(); when ('2') piece.drop(); when ('D') piece.drop(); when ('Q') field.gameover = 1; otherwise ; end; n AND...

Copyright © 2005, Richard A. DeVenezia. All rights reserved. AND... Re-enters the wait method wait: rc = piece.wait(); if rc > 0 then do;... is game over ?... if not, lock the piece and randomly select a new one _self_.piece = _new_ Piece (field, byte(41x + ranuni(0)*7); goto wait; end; * code reaches here if EVENT() is pending; endmethod;

Copyright © 2005, Richard A. DeVenezia. All rights reserved. BUT... n Pending event (by design) is a keyPress n SAS/AF Executor, event handling Invokes onKey of Text Entry SAS/AF event supervisor Text Entry onKey() piece.wait() for event() Text Entry key pressed Control Loop

Copyright © 2005, Richard A. DeVenezia. All rights reserved. Conclusion n SAS/AF is very much alive A gem with many little seen facets n Tetris is still fun n Install SAS/Tetris from

Copyright © 2005, Richard A. DeVenezia. All rights reserved. About the Speaker Speaker Location Telephone Richard A. DeVenezia Independent Consultant 9949 East Steuben Road Remsen, NY (315)