First real game...
Author |
Message |
rollbackman
|
Posted: Tue Jun 02, 2009 7:03 pm Post subject: First real game... |
|
|
What is it you are trying to achieve?
Making a fighting type game.
What is the problem you are having?
In my program if you run it, there are some major errors that I am stuck with. Basically the game is about you making your way through different levels killing different guys. The problem I'm having is that when you press the space bar (which is to shoot) the enemy disappears, I don't want this to happen, I only want it to happen if the ball (which is the shot) hits the cordernates I specified in the program, and a message should pop up, it does for a split second and then it goes in the background.
Describe what you have tried to solve this problem
Everything I could.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Here is the code:
Turing: |
var picID : int := Pic.FileNew ("untitled-2 copy.bmp")
var x, y : int
var move : string (1)
x := 10
y := 15
var picID1 : int := Pic.FileNew ("pathway_through_the_quaking_aspens-(Small)-79356811.bmp")
var x1, y1 : int
x1 := 0
y1 := 0
var picID2 : int := Pic.FileNew ("Untitled-1 copy.bmp")
var x2, y2 : int
x2 := 350
y2 := 0
var circle : int
var circle2 : int
circle := x + 120
circle2 := y + 50
var x3, y3 : int
var yes : string
procedure killed
locate (1, 1)
put "You have killed the enemy "
put "Proceed to the doors" ..
View.Update
end killed
circle := x + 120
circle2 := y + 50
procedure draw
circle := x + 120
circle2 := y + 50
Pic.Draw (picID1, x1, y1, picMerge)
Pic.Draw (picID, x, y, picMerge)
Pic.Draw (picID2, x2, y2, picMerge)
drawfillbox (800, 5, 0, 5, black)
drawfillbox (0, 500, 0, 5, black)
drawfillbox (800, 370, 0, 370, black)
View.Update
%put circle,circle2
end draw
procedure draw2
circle := x + 120
circle2 := y + 50
Pic.Draw (picID1, x1, y1, picMerge)
Pic.Draw (picID, x, y, picMerge)
drawfillbox (800, 5, 0, 5, black)
drawfillbox (0, 500, 0, 5, black)
drawfillbox (800, 370, 0, 370, black)
drawfilloval (circle, circle2, 10, 10, red)
View.Update
%put circle,circle2
end draw2
procedure walk1
y := y + 2
if whatdotcolor (x, y ) = (black) then
y := y - 2
end if
end walk1
procedure walk2
x := x - 2
if whatdotcolor (x, y ) = (black) then
x := x + 2
end if
end walk2
procedure walk3
x := x + 2
if whatdotcolor (x, y ) = (black) then
x := x - 2
end if
end walk3
procedure walk4
y := y - 2
if whatdotcolor (x, y ) = (black) then
y := y + 2
View.Update
end if
end walk4
View.Set ("offscreenonly")
procedure draw1
Pic.Draw (picID1, x1, y1, picMerge)
Pic.Draw (picID, x, y, picMerge)
Pic.Draw (picID2, x2, y2, picMerge)
drawfillbox (800, 5, 0, 5, black)
drawfillbox (0, 500, 0, 5, black)
drawfillbox (800, 370, 0, 370, black)
drawfilloval (circle, circle2, 10, 10, red)
View.Update
Pic.Draw (picID1, x1, y1, picMerge)
Pic.Draw (picID, x, y, picMerge)
Pic.Draw (picID2, x2, y2, picMerge)
drawfillbox (800, 5, 0, 5, black)
drawfillbox (0, 500, 0, 5, black)
drawfillbox (800, 370, 0, 370, black)
drawfilloval (circle, circle2, 10, 10, red)
View.Update
end draw1
View.Update
procedure walk5
y := y + 2
if whatdotcolor (x, y ) = (black) then
y := y - 2
end if
end walk5
procedure walk6
x := x - 2
if whatdotcolor (x, y ) = (black) then
x := x + 2
end if
end walk6
procedure walk7
x := x + 2
if whatdotcolor (x, y ) = (black) then
x := x - 2
end if
end walk7
procedure walk8
y := y - 3
if whatdotcolor (x, y ) = (black) then
y := y + 3
View.Update
end if
end walk8
procedure attack
Pic.Draw (picID1, x1, y1, picMerge)
Pic.Draw (picID, x, y, picMerge)
drawfillbox (800, 5, 0, 5, black)
drawfillbox (0, 500, 0, 5, black)
drawfillbox (800, 370, 0, 370, black)
drawfilloval (circle, circle2, 10, 10, red)
View.Update
Pic.Draw (picID1, x1, y1, picMerge)
Pic.Draw (picID, x, y, picMerge)
drawfillbox (800, 5, 0, 5, black)
drawfillbox (0, 500, 0, 5, black)
drawfillbox (800, 370, 0, 370, black)
View.Update
end attack
View.Update
process drawup
draw
walk1
end drawup
process drawleft
draw
walk2
end drawleft
process drawright
draw
walk3
end drawright
process drawdown
draw
walk4
end drawdown
process attack1
draw
attack
end attack1
process drawup1
draw
walk5
end drawup1
process drawleft1
draw
walk6
end drawleft1
process drawright1
draw
walk7
end drawright1
process drawdown1
draw
walk8
end drawdown1
process killed1
draw2
killed
end killed1
loop
getch (move )
if move = chr (32) then
draw1
end if
if circle = 375 and circle2 = 75 and move = chr (32) then
fork killed1
end if
if move = chr (200) then
fork drawup
end if
if move = chr (203) then
fork drawleft
end if
if move = chr (205) then
fork drawright
end if
if move = chr (208) then
fork drawdown
end if
if move = chr (32) then
fork attack1
end if
if move = chr (200) then
fork drawup1
end if
if move = chr (203) then
fork drawleft1
end if
if move = chr (205) then
fork drawright1
end if
if move = chr (208) then
fork drawdown1
end if
end loop
View.Update
|
Please specify what version of Turing you are using
4.1.1
*Added pictures if you need them, they are attached
Description: |
|
Filesize: |
11.93 KB |
Viewed: |
46 Time(s) |
![Untitled-2 copy.bmp](uploads/attachments/thumbs/t_untitled_2_copy_121.bmp)
|
Description: |
|
Filesize: |
14.9 KB |
Viewed: |
50 Time(s) |
![Untitled-1 copy.bmp](uploads/attachments/thumbs/t_untitled_1_copy_197.bmp)
|
Description: |
|
Filesize: |
1.43 MB |
Viewed: |
48 Time(s) |
![pathway_through_the_quaking_aspens-(Small)-79356811.bmp](uploads/attachments/thumbs/t_pathway_through_the_quaking_aspens_small_79356811_164.bmp)
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Diablo117
![](http://compsci.ca/v3/uploads/user_avatars/6345067144872e0c7b2cf1.jpg)
|
Posted: Tue Jun 02, 2009 7:36 pm Post subject: Re: First real game... |
|
|
If you're going to be making multiple bullets which you can fire, i suggest you read up on arrays, as they are a prerequisite(imo) to making any game.
The dissapearing enemy is probably a faulty collision detection, while I will probably be crucified for it, use whatdotcolor to get you started then upgrade to the box detection method.
The dissapearing message is because of your cls and view.update.
None of this is probably helpful but the errors you are having are mostly very minor and if you read certain tutorials in the Turing Walkthrough you can find their solutions. If you want further help, put that entire game into a .zip and we'll talk
As you may/may not know programmers are very lazy people and cant be bothered to manually download 3 entire pictures and put them in their own folder.
|
|
|
|
|
![](images/spacer.gif) |
|
|