Basic Jumping Demon by Phoenix Software1st Dec 2005 18:13
|
---|
Summary Basic Jumping Demo I did in about 30 minutes. Helpful for n00bs. Thanks to X_MEN for some of the source I got from a topic someone posted. Description You can use this to learn basic techniques of gravity and whatnot. It's probably good for the usual topic's about gravity in 2d and how to make them jump. I got alittle help from a topic about it posted by db programmer 12, and X_MEN. Well enjoy. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `Basic Jumping Demo `Programmed By: **Name Erased** `Version: 1.0 - Bulit in Graphics `Declare variables used `variables for cords xpos = 100 ypos = 350 `Setup the framerate and window `Intalize the window setup set window on set window title "Basic Jumping Demo - DBC - **Insert Your Name Here**" set window layout 1,1,1 set window position 100,200 set window size 640,480 `Configurate the framerate sync on sync rate 30 `Hide the mouse pointer hide mouse `Start a new loop do `Clear screen so no flicker cls `Disable the escape key disable escapekey `You can show the pointer by clicking `This is to avoid frustration to our player if mouseclick() = 1 or mouseclick() = 2 then show mouse `You can hide it again by pressing the enterkey if returnkey() = 1 then hide mouse `Draw the main character a green circle ink rgb(0,255,0),1 circle xpos,ypos-jumping,10 `Configurate controls if leftkey() = 1 then xpos = xpos - 7 if rightkey() = 1 then xpos = xpos + 7 `Jumping if spacekey()=1 and jumping=0 then jump=1 if jump=1 then jumping=jumping+20 if jump=0 and jumping>0 then jumping=jumping-20 if jumping>60 then jump=0 if spacekey() = 0 then jump = 0 if rightkey() = 1 and jump = 1 then xpos = xpos + 4 if leftkey() = 1 and jump = 1 then xpos = xpos - 4 `Collision if xpos <= 1 then xpos = xpos + 7 `Refresh the screen sync loop |