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

Username:   Password: 
 RegisterRegister   
 *Trying* to re-create a game in turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
KC 40oz




PostPosted: Thu Dec 02, 2004 10:06 am   Post subject: *Trying* to re-create a game in turing

i want to remake
www.ebaumsworld.com/squares.html
in turing
so far i have the square moving, and thats it Razz
i was trying to get the boxes flying in to work but i really dont understand how drawfillbox works correctly
and i need somewhere to upload so i can work on it at home
and if anyone can give some idea / help on how to tackle this project, it would be appreciated
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Thu Dec 02, 2004 10:48 am   Post subject: (No subject)

Pretty neat game. Shouldn't be too difficult actually. For starters, you can upload it here. (you can upload a .t file, or maybe if you want you could compress it and password protect a zip)

drawfillbox works like this:
Make a box (in your head). Look at the lower left corner. On a cartesian plane, that point would be specified by an x and a y coordinate. Think of what that might be. Now look at the top right corner. The same goes for that. So all you do is decide what these coordinates would be and call drawfillbox with them.

code:
drawfillbox(x1, y1, x2, y2, clr)

x1, y1 would be the lower left corner
x2, y2 would be the upper right corner (of course it's just a box so if you mix them up you shouldn't notice a difference)
clr is the colour. from 0 to 256 (black is 7)
KC 40oz




PostPosted: Thu Dec 02, 2004 11:17 am   Post subject: (No subject)

hmm i thought i attached it
hum
also, i wonder if theres a way to recreate the box spinning effect?



squaresgame.t
 Description:

Download
 Filename:  squaresgame.t
 Filesize:  819 Bytes
 Downloaded:  115 Time(s)

Mazer




PostPosted: Thu Dec 02, 2004 11:53 am   Post subject: (No subject)

First, don't use a process. I used to live by them in the past, but it's best to learn to do without them. Besides, in this case it'd probably be simpler without them.

KC 40oz wrote:
hmm i thought i attached it
hum
also, i wonder if theres a way to recreate the box spinning effect?

Yeah, trig!
Suppose we have a box centered at (0,0). Each corner of the box would be x units away from the center (make x bigger and the points are further away, making the box bigger). Thus a point (let's say, top right) would have (x,y) coordinates as (x * cosd(angle + 45), y * sind(angle + 45)). Of course rotating means you can't use drawfillbox on the main box. You could try using drawfillpolygon. You'll need to specify coordinates for each corner of the box instaed of just lower left and upper right like before.
Viper




PostPosted: Thu Dec 02, 2004 2:06 pm   Post subject: (No subject)

as far as actualy helping i cant really do that bc i have same problem but you can download turing

look around in here http://www.compsci.ca/v2/viewtopic.php?t=2996&postdays=0&postorder=asc&start=120
KC 40oz




PostPosted: Thu Dec 02, 2004 3:51 pm   Post subject: (No subject)

oh ive had turing at home for a month or two
and Coutsos, i am in grade 10 math, i am not yet familiar with trig or sin cos rtan ^_^
KC 40oz




PostPosted: Thu Dec 02, 2004 5:08 pm   Post subject: (No subject)

The thing about drawfillbox that i dont get is how to make it scroll across the screen
and i also have to have the program select random spots and whether to go left to right or up to down or vice versa
Mazer




PostPosted: Thu Dec 02, 2004 5:26 pm   Post subject: (No subject)

Grade 10 math? Sorry, didn't know. But it's not actually that difficult. In fact, go bug your compsci/math teacher before/after class to explain to you how to use the trig functions. That should look good.
As for the scrolling box thing, just use variables instead of actual values for the coordinates. This way, you can increase or decrease them in a loop to move the box around. Try to look up a tutorial on animation.
Sponsor
Sponsor
Sponsor
sponsor
KC 40oz




PostPosted: Thu Dec 02, 2004 5:58 pm   Post subject: (No subject)

i am so useless
alright so i made this little program to test out animating boxes (didnt check out the tutorial)
code:

var loc: int := 100
var loc2 : int := 120
View.Set("offscreenonly")
loop
cls
delay(25)
drawfillbox (loc, loc, loc2, loc2, black)
loc:=loc+1
loc2:=loc2+1
View.Update
end loop

now what would i do to make to go only left or only right or only up or only down, not diagonal?
i feel like a tool
Mazer




PostPosted: Thu Dec 02, 2004 6:02 pm   Post subject: (No subject)

Whoa! You're using the same variable for the x and y coordinate! Try this:
code:

var x: int := 100
var y : int := 120
View.Set("offscreenonly")

loop
    cls
    delay(25)
    drawfillbox (x - 20, y - 20, x + 20, y + 20, black)
    x := x + 1
    %y := y + 1
    View.Update
end loop

I commented out the part about increasing the y coordinate so that it will move horizontally. If you'd like it to move vertically, comment the x line out and uncomment the y line.
KC 40oz




PostPosted: Thu Dec 02, 2004 9:31 pm   Post subject: (No subject)

i did a bit more
its terribly coded yes
but works to some extent
i still need to be able to 'collect' squares
and lose when you hit red ones
in due time though
anyone feel free to tell me how to not suck so much (i.e. shorten down those 6 processes to less code)
and yeah i know i have a couple wasted arrays
oh well ill clean that up later
EDIT: ahahah disregard the toms a fag message ^_^



squares2.t
 Description:

Download
 Filename:  squares2.t
 Filesize:  3.74 KB
 Downloaded:  139 Time(s)

KC 40oz




PostPosted: Fri Dec 03, 2004 12:11 am   Post subject: (No subject)

updated it ALOT more
about to go to be
now you can collect black squares and your score goes up
also, there is a start button
although red squares do nothing yet



squares2.t
 Description:

Download
 Filename:  squares2.t
 Filesize:  4.93 KB
 Downloaded:  154 Time(s)

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  [ 12 Posts ]
Jump to:   


Style:  
Search: