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

Username:   Password: 
 RegisterRegister   
 NET GAME
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
paulkwatyra




PostPosted: Sun Nov 20, 2005 3:11 pm   Post subject: NET GAME

Hey pplz k im new at turing and i have made a game very simple
%%%%%%%%%%%%%%%%%%%%%%%%%
var chars,chars2:array char of boolean
var x,y,x2,y2:int
x := 250
y := 200
x2 := 400
y2 := 400


loop

Input.KeyDown (chars)

if chars (KEY_UP_ARROW) then %player one movement up%
y := y + 10
end if
if chars (KEY_RIGHT_ARROW) then %right%
x := x + 10
end if
if chars (KEY_LEFT_ARROW) then %left%
x := x - 10
end if
if chars (KEY_DOWN_ARROW) then %down%
y := y - 10
end if
Draw.FillOval (x, y, 4, 4, 13)




Input.KeyDown (chars2)

if chars2 ('w') then %player two movement up%
y2 := y2 + 10
end if
if chars2 ('d') then %right%
x2 := x2 + 10
end if
if chars2 ('a') then %left%
x2 := x2 - 10
end if
if chars2 ('s') then %down%
y2 := y2 - 10
end if


Draw.FillOval (x2, y2, 4, 4, 60)

delay (20)
cls
end loop
%%%%%%%%%%%%%%%%%%%%%%%
and i thought to myself i would like to make it a network game where one person can play from his computer and the other from his, and i have NO clue how to do that im somewhat familiar with opening a network however i dont understand how to transfer info from the ball variables that are moving HELP WOULD BE GREAT
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sun Nov 20, 2005 6:10 pm   Post subject: (No subject)

Please don't double post, especially topics.

Look in the tutorials section for help before posting here, as it happens, we have a .NET tutorial:

Turing Walkthrough - http://www.compsci.ca/v2/viewtopic.php?t=8808
.NET tutorial - http://www.compsci.ca/v2/viewtopic.php?t=5795
Mr. T




PostPosted: Sun Nov 20, 2005 7:30 pm   Post subject: Re: NET GAME

paulkwatyra wrote:
and i thought to myself i would like to make it a network game where one person can play from his computer and the other from his, and i have NO clue how to do that im somewhat familiar with opening a network however i dont understand how to transfer info from the ball variables that are moving HELP WOULD BE GREAT

I think it's best if you learn the basics before getting into the more intricate elements of programming.
paulkwatyra




PostPosted: Sun Nov 20, 2005 8:55 pm   Post subject: (No subject)

i do know programming i just dont understand how networks work in turing
Cervantes




PostPosted: Sun Nov 20, 2005 9:03 pm   Post subject: (No subject)

paulkwatyra wrote:
i do know programming i just dont understand how networks work in turing

If you were about ready to learn about networking, you'd have a View.Update in there (not that that's related to networking, but it is basic). You'd only be using one array char of boolean (again, not that it's related...). You'd be using a coordinate variable type.

I suggest you use the Turing Walkthrough to work your way towards networking.
paulkwatyra




PostPosted: Sun Nov 20, 2005 9:09 pm   Post subject: (No subject)

I completed the rest of my game today and i need to know how to network it i am posting the game for some help so if neone can help me that'll be great, plz dont take ne parts from game. Also note this game is still in the finishing stage so there are some bugs as i still have a week to finish it for my project at skool

[code]
var bomb : array 1 .. 4000 of boolean
var bombx : array 1 .. 4000 of int
var bomby : array 1 .. 4000 of int
var bomb2 : array 1 .. 4000 of boolean
var bomb2x : array 1 .. 4000 of int
var bomb2y : array 1 .. 4000 of int
var i, y, i2, y2 : int
var chars : array char of boolean
var chars2 : array char of boolean
var bombcounter1 : int
var bombcounter2 : int
var player1dead : boolean
var player2dead : boolean
var laser : int
var laser2 : int
i := 500
y := 500
i2 := 100
y2 := 100
for x : 1 .. 4000
bomb (x) := false
end for
for x : 1 .. 4000
bomb2 (x) := false
end for
bombcounter1 := 0
bombcounter2 := 0
player1dead := false
player2dead := false
laser := 60
laser2 := 60
procedure createballs ()
Draw.FillOval (200, 200, 4, 4, white)
Draw.FillOval (400, 250, 4, 4, white)
Draw.FillOval (100, 270, 4, 4, white)
Draw.FillOval (300, 210, 4, 4, white)
Draw.FillOval (400, 100, 4, 4, white)
Draw.FillOval (300, 250, 4, 4, white)
Draw.FillOval (200, 370, 4, 4, white)
Draw.FillOval (100, 410, 4, 4, white)
Draw.FillOval (110, 210, 4, 4, white)
Draw.FillOval (220, 220, 4, 4, white)
Draw.FillOval (330, 240, 4, 4, white)
Draw.FillOval (440, 250, 4, 4, white)
Draw.FillOval (550, 170, 4, 4, white)
Draw.FillOval (101, 280, 4, 4, white)
Draw.FillOval (202, 390, 4, 4, white)
Draw.FillOval (304, 420, 4, 4, white)
end createballs

View.Set ("graphics:max;max")
colorback (black)
cls
setscreen ("offscreenonly")
loop
color (white)
put "Amount Laser left :", laser
color (brightgreen)
put "Amount Laser Left :", laser2
Input.KeyDown (chars)
if chars ('j') and chars (KEY_UP_ARROW) and laser > 0 then
Draw.DashedLine (i, y, i, maxy, drawDash, brightred)
laser := laser - 1
if i = i2 and y < y2 then
player2dead := true

end if
elsif chars ('j') and chars (KEY_RIGHT_ARROW) and laser > 0 then
Draw.DashedLine (i, y, maxx, y, drawDash, brightred)
laser := laser - 1
if y = y2 and i < i2 then
player2dead := true
end if
elsif chars ('j') and chars (KEY_LEFT_ARROW) and laser > 0 then
Draw.DashedLine (i, y, 0, y, drawDash, brightred)
laser := laser - 1
if y = y2 and i > i2 then
player2dead := true

end if
elsif chars ('j') and chars (KEY_DOWN_ARROW) and laser > 0 then
Draw.DashedLine (i, y, i, 0, drawDash, brightred)
laser := laser - 1
if i = i2 and y > y2 then
player2dead := true

end if
end if

if chars (KEY_UP_ARROW) and y + 10 < maxy then
Draw.FillOval (i, y, 4, 4, black)
y := y + 10
end if
if chars (KEY_RIGHT_ARROW) and i < maxx then
Draw.FillOval (i, y, 4, 4, black)
i := i + 10
end if
if chars (KEY_LEFT_ARROW) and i > 0 then
Draw.FillOval (i, y, 4, 4, black)
i := i - 10
end if
if chars (KEY_DOWN_ARROW) and y > 0 then
Draw.FillOval (i, y, 4, 4, black)
y := y - 10
end if
if chars ('k') and bombcounter1 < 4000 then
bombcounter1 := bombcounter1 + 1
bombx (bombcounter1) := i
bomby (bombcounter1) := y
bomb (bombcounter1) := true
end if
if chars ('p') then
createballs ()
end if
if chars ('o') then
i := Rand.Int (1, 60) * 10
y := Rand.Int (1, 60) * 10
end if
if chars ('l') then
Draw.FillOval (Rand.Int (1, 600), Rand.Int (1, 600), 4, 4, white)
Draw.FillOval (Rand.Int (1, 600), Rand.Int (1, 600), 4, 4, white)
Draw.FillOval (Rand.Int (1, 600), Rand.Int (1, 600), 4, 4, white)
Draw.FillOval (Rand.Int (1, 600), Rand.Int (1, 600), 4, 4, white)
end if

Draw.FillOval (i, y, 4, 4, white)
if chars ('u') then
Draw.FillOval (i, y, 4, 4, black)
end if

for x : 1 .. 4000
if bomb (x) then
Draw.FillOval (bombx (x), bomby (x), 4, 4, white)
end if
end for

if chars ('e') and chars (KEY_UP_ARROW) and laser > 0 then
Draw.DashedLine (i, y, i, maxy, drawDash, brightred)
laser2 := laser2 - 1
if i = i2 and y < y2 then
player1dead := true

end if
elsif chars ('e') and chars (KEY_RIGHT_ARROW) and laser2 > 0 then
Draw.DashedLine (i2, y2, maxx, y2, drawDash, brightred)
laser2 := laser2 - 1
if y2 = y and i2 < i then
player1dead := true
end if
elsif chars ('e') and chars (KEY_LEFT_ARROW) and laser2 > 0 then
Draw.DashedLine (i2, y2, 0, y2, drawDash, brightred)
laser2 := laser2 - 1
if y2 = y and i2 > i then
player1dead := true

end if
elsif chars ('e') and chars (KEY_DOWN_ARROW) and laser > 0 then
Draw.DashedLine (i2, y2, i2, 0, drawDash, brightred)
laser2 := laser2 - 1
if i2 = i and y2 > y then
player1dead := true

end if
end if

if chars ('w') and y2 + 10 < maxy then
Draw.FillOval (i2, y2, 4, 4, black)
y2 := y2 + 10
end if
if chars ('d') and i2 < maxx then
Draw.FillOval (i2, y2, 4, 4, black)
i2 := i2 + 10
end if

if chars ('a') and i2 > 0 then
Draw.FillOval (i2, y2, 4, 4, black)
i2 := i2 - 10
end if
if chars ('s') and y2 > 0 then
Draw.FillOval (i2, y2, 4, 4, black)
y2 := y2 - 10
end if
if chars ('q') and bombcounter2 < 4000 then
bombcounter2 := bombcounter2 + 1
bomb2x (bombcounter2) := i2
bomb2y (bombcounter2) := y2
bomb2 (bombcounter2) := true
end if
for x : 1 .. 4000
if bomb2 (x) then
Draw.FillOval (bomb2x (x), bomb2y (x), 4, 4, brightgreen)
end if
end for
Draw.FillOval (i2, y2, 4, 4, brightgreen)

View.Update
delay (20)
cls
for x : 1 .. bombcounter2
if i = bomb2x (x) and y = bomb2y (x) and bomb2 (x) then

color (yellow)
put "Player 1 hits bomb Player 2 wins"
player1dead := true
exit
end if
end for
for x : 1 .. bombcounter1
if i2 = bombx (x) and y2 = bomby (x) and bomb (x) then
color (yellow)
put "Player 2 hits bomb Player 1 Wins"
player2dead := true
exit
end if
end for
exit when player1dead = true or player2dead = true

end loop[/color]
[/code]





THANX A LOT
md




PostPosted: Sun Nov 20, 2005 9:16 pm   Post subject: (No subject)

I sugest you learn a lot more about types (records?), procdures, and functions before you even think of trying to do anything with the network. Networking is an advanced topic, whch required a very good knowledge of the basic principles of good programming. Your code shows that you don't even understand the basics. That's not to insult you or anything, just point out that you're trying to do something that is far beyond your abilities; a much better idea right now would be to take the code you posed and re-write it using types and functions. If you can get that done and understand it (and know why it's better) then you might be able to handle some networking.
paulkwatyra




PostPosted: Sun Nov 20, 2005 9:25 pm   Post subject: (No subject)

alright good idea thanx a lot
Sponsor
Sponsor
Sponsor
sponsor
Mr. T




PostPosted: Sun Nov 20, 2005 10:33 pm   Post subject: Alex's Opinion

paulkwatyra wrote:
Hey pplz k im new at turing and i have made a game very simple

paulkwatyra wrote:
i do know programming i just dont understand how networks work in turing

Maybe I misunderstood your first statement.
Tony




PostPosted: Sun Nov 20, 2005 10:56 pm   Post subject: Re: Alex's Opinion

Pwned wrote:
paulkwatyra wrote:
Hey pplz k im new at turing and i have made a game very simple

paulkwatyra wrote:
i do know programming i just dont understand how networks work in turing

Maybe I misunderstood your first statement.

I seem to be misunderstanding a lot of things..

from another post
paulkwatyra wrote:
ok so im pretty good with the entire turing language and i want to learn a new one
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Mr. T




PostPosted: Sun Nov 20, 2005 11:27 pm   Post subject: Alex's Opinion

paulkwatyra wrote:
ok so im pretty good with the entire turing language and i want to learn a new one... i am new at programming tho as i just learned turing this year

Quite the hypocrite, indeed.
MysticVegeta




PostPosted: Sun Nov 20, 2005 11:47 pm   Post subject: (No subject)

Come on Come on guys! Lets not forget, people will do anything for help, and the opposite of that thing to get ahead, I find this guy smart, maybe he should take a break from programming and do some business!
sarcasm intended
[Gandalf]




PostPosted: Mon Nov 21, 2005 1:50 am   Post subject: Re: Alex's Opinion

Pwned wrote:
paulkwatyra wrote:
ok so im pretty good with the entire turing language and i want to learn a new one... i am new at programming tho as i just learned turing this year

Quite the hypocrite, indeed.

Maybe he just thinks he can master Turing and the basics of programming in a day? Laughing
paulkwatyra




PostPosted: Mon Nov 21, 2005 8:17 am   Post subject: (No subject)

not in a day a few months im just getting bored with all the things we learn in skcool
ZeroPaladn




PostPosted: Mon Nov 21, 2005 9:53 am   Post subject: (No subject)

ive been working at turing for 3 years now, and i havent even started learning about net with turing. if you think that you can learn an entire programming language in a few months then you got something coming for ya. take it easy, and learn new things, like cervantes said.

i will admit this is a neat game though.
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 3  [ 43 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: