TGC Codebase Backup



Squash by Anonymous Coder

25th May 2004 12:59
Summary

This is a simple squash game involving a sphere bouncing off the walls of a room and you hitting it with your racket. if the ball goes past you it will be replaced. By Chris Perre



Description

This is a simple squash game involving a sphere bouncing off the walls of a room and you hitting it with your racket. if the ball goes past you it will be replaced.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    *******************
*   Squash        *
*by Chris Perren  *
*******************




x1=0
y1=18
z1=0

hide mouse



make object cube 6,74
make object cube 3,74
make object cube 4,74
make object cube 5,74
make object cube 7,74

make object sphere 1,4
make object cube 2,10
color object 2,rgb(255,0,0)
color object 6,rgb(200,200,200)



ymovement=1.5
zmovement=2
xmovement=1.5

scale object 7,1,100,400
scale object 6,100,1,400
scale object 5,1,100,400
scale object 4,100,1,400
scale object 2,100,100,1
position camera 0,20,-50

position object 7,37,0,100
position object 6,0,37,100
position object 5,-37,0,100
position object 4,0,0,100
position object 3,0,37,137

position object 2,x1,y1,z1

set object 2,0,1,1,1
sync on


DO




position object 1,x,y,z
position object 2,x1,y1,z1

y=y+ymovement
x=x+xmovement
z=z+zmovement

if z>100 then zmovement=-2


if x>35 then xmovement=-1.5
if x<-35 then xmovement=1.5
if y>35 then ymovement=-1.5
if y<2 then ymovement=1.5

if object hit(1,2)=1 then zmovement=2


if upkey()=1 then y1=y1+2
if leftkey()=1 then x1=x1-2
if rightkey()=1 then x1=x1+2
if downkey()=1 then y1=y1-2

if y1>31 then y1=31
if y1<6 then y1=6
if x1>31 then x1=31
if x1<-31 then x1=-31

if z<-30 then gosub reset

sync
LOOP

reset:

zmovement=2
z=0
y=0
x=0
return