TGC Codebase Backup



Simple Force Feedback Sample by BMacZero

26th Dec 2005 13:11
Summary

This program shows a sample of several force feedback commands.



Description

This is basically a short adventure, utilizing a control device with "force feedback" capabilities. Text on the screen, complemented by actions of the joystick, simulates a wild ride, ending in disaster.
Unfortunately I don't have a controller with force feedback, so if there are any mistakes please tell me.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem this program is an example that is supposed to demonstrate the force feedback commands.
rem sorry it only works if you have a control device with force feedback plugged in.

rem set text
set text font "Ariel"
set text size 14
start:
rem check for control devices
if control device name$()="" then goto sad

rem print control device name
print "You are using a ";Control device name$();" control device..."

rem check to see if user agreees
Input "correct? (press y or n)",dev$
if dev$="y" then goto fun
if dev$="n" then goto error

rem tell device to "go crazy" =P
rem uses all but one feedback command
fun:
print "Hold on to your ";control device name$();"!!"
Force up 75
Force down 42
force left 100
force right 5
force no effect
print "fun, huh?"
wait 2000
print "we're off again!!"
force angle 30,45,500
wait 500
force down 50
wait 500
print "Water ahead!!"
wait 500
print "SPLASH!!!"
force impact 30,500
force water effect 60,3000
wait 3000
print "phew!!"
wait 2000
force shoot 60,500
print "Oops! Backfire!"
wait 2000
force up 40
wait 500
print "Aggh! Bumpy road ahead!"
force chainsaw 70,4000
wait 4000
print "WALLL!!!"
wait 1000
force impact 100, 1000
force no effect
print "You die..."
wait key
end

sad:
print "Sorry, your device does not have force feedback capabilities,"
print "or else you do not have one plugged in"
wait key
end

error:
print "There has been an error. Try again?"
input "(press y or n)-->",error$
if error$="y"
  goto start
else end
endif