Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Gaming Help!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Chris Pain




PostPosted: Fri Oct 27, 2006 8:43 pm   Post subject: Gaming Help!!!

Hmm well i'm new here. So, HI! it's nice to meet you all. I'm doing this project for a gr11 class. We need to basically make a game. Now i found this code on this forum, and want to further develop it. and i seriously hate turing and i know nothing of it, so i need you're help please!

1. Are all the comments right about what the actual code does?

2. how can i insert the bottom code into the 1st to make it run properly. i've tried to actually just put the variables, procedure and run the
procedure where draws is, but the screen becomes blank Sad

3. Can someone PLEASE tell me how to put boundaries. Basically i would like this to have the stick figure jumping over the lines, and if it hits them, you lose.


----CODE FOUND-----
var x, y, spd, check : int
% var for input.keydown (key)
var key : array char of boolean
setscreen ("graphics,offscreenonly")
%sets variables x and y
x := 10
y := 50
%the stick man, and bottom line
procedure draw
%head
drawoval (x, y, 10, 10, black)

%body
drawline (x, y - 10, x, y - 30, black)

%leg
drawline (x, y - 30, x - 10, y - 40, black)

%leg
drawline (x, y - 30, x + 10, y - 40, black)

%arms
drawline (x - 10, y - 20, x + 10, y - 20, black)

%bottom of screen line
drawline (1, 10, maxx, 10, black)

end draw
%draw procedure (stick figure + bottom line)
draw
%var check = how high thefigure can go (0)
check := 0
%var spd = gravity force (0)
spd := 0
loop
View.Update

%sets key as var for key pressed
Input.KeyDown (key)

%check is preset to 0
if check = 0 then

%if w is pressed (Input.KeyDown), spd = 32 and check = 0
if key ('w') then

%var spd = 32
spd := 32

%var check = 0
check := 0

end if

end if

%Moves Horizontally

%d is pressed
if key ('d') then

%moves figure 5 to the right
x := x + 5

%a is pressed
elsif key ('a') then

%moves figure 5 to the left
x := x - 5

end if

%height of jump
%once y= more then 51 check = 1
if y >= 51 then

check := 1

% if y = 50 then check = 0
elsif y = 50 then

check := 0

end if

%controls the rate of fall (gravity)
%divides spd by 2 if greater than 0
if spd > 0 then
spd := spd div 2

elsif spd < 0 then


spd := spd * 2
end if

% if spd = 1 then it is = to -1
if spd = 1 then
spd := -1
end if

% adds gravity to var y
y := y + spd

%sets gravity (spd) to 0 when y = less than 50.
%if y is more than 50, then y always increases (keeping the figure afloat)
if y <= 50 then
spd := 0
y := 50
end if


%delay
delay (50)

%clear screen
cls

%procedure draw
draw

end loop




--- Code wanted to properly import ---

var x1, y1 : int

x1 := 630
y1 := 10
procedure lines

loop
drawline (x1 , y1 , x1, y1 + 50, red)

x1 := x1-150

delay (500)

end loop

end lines

lines
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Fri Oct 27, 2006 11:25 pm   Post subject: (No subject)

first off, the code you stole sucks.

second, use "code" tags when posting code.

THIRD:: We dont do homework, i guess you fail for not paying attention in class, your fault, not ours,

Though, if you want to make an easy game, Aim for pong.

Think about how the game works, and try to creat that.

good luck
DemonZ




PostPosted: Wed Nov 01, 2006 10:18 pm   Post subject: (No subject)

yah i agree with toker, u should have payed attention in class, and not just snoozing around and then at the final project u expect us to do it for u, initialize or understand how the game is to function and then write ur solution, if u need help with a Particular Problem and not the entire thing, than we can help, u, otherwise, bug off.
Dan




PostPosted: Thu Nov 02, 2006 2:32 pm   Post subject: (No subject)

All of the information you whont can be found in the turing tutorals, look at the walk threw post for a good listing of them.

1. and 2. You should realy start your game for scratch. As has been metioned above, the origanl code is not the best in the world. Also if this is for a school assigment it is ushely looked down apoen to use other peoleops code with out credtiing them and i whould think your teacher inintended you to make your own game not make some one eltes better.

3. "Boundaries" whould be done with some kind of colesion dection, there are many kinds to choices from and alot of them are expained in tutuorals in the tutoral section.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony




PostPosted: Thu Nov 02, 2006 2:56 pm   Post subject: Re: Gaming Help!!!

Chris Pain wrote:
Now i found this code on this forum

You should link to the found code, not blantly take it and repost it. You haven't credited the original author.

Also, I think (biasly) that you could benifit from reading this article

Chris Pain wrote:
and i seriously hate turing and i know nothing of it, so i need you're help please!

Is it too late to drop the course?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Windsurfer




PostPosted: Thu Nov 02, 2006 6:44 pm   Post subject: (No subject)

And if you nothing of Turing, how can you hate it?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: