GAMES MASTER TUTORIAL, part 3 With Dr Andy Wright I was recently asked by a Games Master user how to get balls bouncing around realistically. I set out to write a simple demo for him, and ran into a few puzzles. I think the demo might beuseful to other users, so I reproduce it here. The actual program is very short - just one module in Games Master Control Language. It simply places a few sprites of types 1 and 2 (different coloured balls) at randomly-chosenX and Y positions. They are all placed on collision plane 4, but any old collision plane would do. Since they are all on the same plane, the sprites can hit each other, rather than pass 'behind' or 'in front of' each other. *** MODULE 1 *** BORDER 7 PAPER 0 CLS PLACE 1,80,80,4 PLACE 1,30,50,4 PLACE 1,110,90,4 PLACE 2,20,100,4 PLACE 2,55,66,4 PLACE 2,77,33,4 PLACE 2,123,99,4 More interesting is the SPRITE DETAILS setup for the balls. Thisis given below for sprite type 2, (called SHOT2). Sprite type 1 is very similar. To bounce correctly, the sprite must start with a reasonable Y (up or down)speed, say, between -10 and +10. Lower absolute values give less vigorous bounces. Very low values give no bouncing at all. Make sure that BOUNCES and FEELS GRAVITY are set to YES. MOVEMENT TYPE should be SIMPLE, for automatic motion. You can try altering X SPEED. The sprites must be EDGE LIMITED, or they will notbounce off the screen edge. SPRITE 2: SHOT2 TOTAL FRAMES: 1 WIDTH: 8 HEIGHT: 7 CURRENT FRAME: 1 ANIM. SEQUENCE : 0 CONDITIONAL: NO MOVEMENT TYPE: 1 (SIMPLE) X SPEED: -1 PIXEL X SPEED: NO Y SPEED: -6 PATH: 0 COLLISION TYPE: 1 BOUNCES: YES HALTS ON IMPACT: NO FEELS GRAVITY: YES NEEDS SUPPORT: NO EDGE LIMITED: YES Some of the overall GAME DETAILS also matter - if the FORCE OF GRAVITY is higher, the balls will fall faster. The MAXIMUM FALLING SPEED mustn't be too low, or the balls will fall more like snowflakes. Here are the settings I used: **** GLOBAL GAME VARIABLES **** MINIMUM GAME DELAY: 1 FORCE OF GRAVITY: 1 MAXIMUM FALLING SPEED: 20 BORDER COLOUR: 0 DELAYED WRAP: NO EVERY CYCLE MODULE: 0 ROM INTERRUPTS: NO ALLOW EXIT FROM GAME: YES TOP EDGE: 191 BOTTOM EDGE: 0 Good Luck from Andy Wright.