Basic car movement game thing.
Author |
Message |
recneps
|
|
|
|
|
Sponsor Sponsor
|
|
|
sport
|
Posted: Sat Jan 17, 2004 10:04 pm Post subject: Useful Code |
|
|
Excellent Program. It will be put to good use.
|
|
|
|
|
|
DanShadow
|
Posted: Sat Jan 17, 2004 10:10 pm Post subject: (No subject) |
|
|
hm...pretty nice, I remember doing a program similar to this before. Although, I wish you would have developed your own code without taking some from another program, but have some bits anyway.
+5 Bits
|
|
|
|
|
|
Leiak
|
Posted: Sat Jan 17, 2004 11:22 pm Post subject: (No subject) |
|
|
i cant get it to work on my program can someone direct me towards a url that i can download a better turing program plz and thankie
|
|
|
|
|
|
recneps
|
Posted: Sun Jan 18, 2004 4:26 pm Post subject: (No subject) |
|
|
i would, but i have gr 10 math next sem, and i dunno how i would make it move forward at that angle:) (i only borrowed 2 lines )
|
|
|
|
|
|
recneps
|
Posted: Sun Jan 18, 2004 4:27 pm Post subject: (No subject) |
|
|
and about the turing download, go to compsci main page, theres a linkto turing 4.0.5 update
|
|
|
|
|
|
shorthair
|
Posted: Sun Jan 18, 2004 4:45 pm Post subject: (No subject) |
|
|
do you mind if i steal like 20 lines of that code for a game of mine , il give you a bit
|
|
|
|
|
|
recneps
|
Posted: Wed Jan 21, 2004 4:02 pm Post subject: (No subject) |
|
|
doesnt matter (i borrowed 2 lines anyway )
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
netninja
|
Posted: Wed Feb 11, 2004 10:35 pm Post subject: (No subject) |
|
|
The car was really screwed up so i looked over the code, and i found that you put setscreen ("graphics:nooffscreenonly") instead of setscreen ("offscreenonly").
Once i fixed that, the choppy graphics dissappeared Did anyone else get that flashing car instead of a nice solid car?
|
|
|
|
|
|
Maverick
|
Posted: Wed Feb 11, 2004 10:42 pm Post subject: (No subject) |
|
|
hey really sweet prog man
|
|
|
|
|
|
GUI.GetScrollBarWidth : i
|
Posted: Fri Feb 13, 2004 5:56 pm Post subject: (No subject) |
|
|
super cool. cars r fun. but the graphics r choppy
|
|
|
|
|
|
rizzix
|
Posted: Sun Feb 15, 2004 9:59 pm Post subject: (No subject) |
|
|
hehe wanna fix the graphics?
here's the modified code using my library..
code: |
include "stdlib.t"
%Made by receneps. Yay.
%Some code taken from spacegame example (but i made it easier to understand :D)
%Use up, left and right to move. Esc to quit.
%All variable names are self explanatory :)
const maxframerate : int := 30
const numships : int := 36
var keys : array char of boolean
const up : char := chr (200)
const left : char := chr (203)
const right : char := chr (205)
const esc : char := chr (27)
const shiprad : int := 19
const shipfrad : int := 23
var ship : array 0 .. 35 of int
var shipf : array 0 .. 35 of int
var angle : int
var x, y, dx, dy : real
procedure drawscreen
%draw the ship with the appropriate angle.
GFXDrawRefreshPic (ship (angle), round (x) - shiprad, round (y) - shiprad)
%Pic.Draw (ship (angle), round (x) - shiprad, round (y) - shiprad, picMerge)
%View.Update
end drawscreen
drawfillbox (0, 0, maxx, maxy, black)
setscreen ("offscreenonly")
ship (0) := Pic.FileNew ("crappycar.bmp")
Pic.SetTransparentColour (ship (0), black)
for i : 1 .. numships - 1 %make all frames of the ship.(-1 because the 0 is already set.)
ship (i) := Pic.Rotate (ship (0), i * (360 div numships), shiprad, shiprad)
end for
angle := 0
x := maxx div 2
y := maxy div 2
dx := 0
dy := 0
colourback (black)
loop %get key info
Input.KeyDown (keys)
if keys (up) then
dx -= sind (angle * 10) %dont ask me, only gr 9 math (gr 10 next sem!)
dy += cosd (angle * 10) %got from spacegame exmaple :D lol
end if
if keys (right) then %rotate if right
angle := (angle - 1) mod numships
delay (25)
end if
if keys (left) then %rotate if left
angle := (angle + 1) mod numships
delay (25)
end if
if keys (esc) then %exit when hit esc
exit
end if
dx := min (max (dx, -20), 20) %Set "speed limit"
dy := min (max (dy, -20), 20)
x += dx
y += dy
if x > maxx then
x := maxx %keep car in bounds for x
end if
if x < 0 then
x := 0
end if
if y > maxy then
y := maxy %keep car in bounds for y
end if
if y < 0 then
y := 0
end if
drawscreen
dx := 0
dy := 0
end loop
|
and attached is the library...
Description: |
just part of it .. (include only tested stuff) |
|
Download |
Filename: |
stdlib.t |
Filesize: |
13.73 KB |
Downloaded: |
392 Time(s) |
|
|
|
|
|
|
|
|