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

Username:   Password: 
 RegisterRegister   
 trying to track my ship
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ktomislav




PostPosted: Wed Jan 13, 2010 9:04 am   Post subject: Re: trying to track my ship

You are doing it wrong. Ship isn't the position of the ship, it is a picure.
Try this:
Turing:
Draw.Oval (x + Pic.Width (shipmove) div 2,y  + Pic.Height (shipmove) div 2,1,1,brightblue)


And you should resize your picture to be the same size as your ship is s that there is ono white left/right/up/down of your ship.
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Wed Jan 13, 2010 9:06 am   Post subject: Re: trying to track my ship

stickdude32 wrote:

thats the thing. im trying to find the ships position, but i cant. the variables for the ship are not at the ship actual position. there way up and over the outer edge.


You aren't telling it to draw where the ship is, you're telling it to draw at the coordinates reffered to by the variable "ship".

When you use Pic.FileNew, it returns an integer value (normally 1 for the first image), so you're telling it to draw at (1,1). What coordinates did you use to tell it where to draw the ship?
stickdude32




PostPosted: Wed Jan 13, 2010 9:13 am   Post subject: Re: trying to track my ship

You aren't telling it to draw where the ship is, you're telling it to draw at the coordinates reffered to by the variable "ship".

When you use Pic.FileNew, it returns an integer value (normally 1 for the first image), so you're telling it to draw at (1,1). What coordinates did you use to tell it where to draw the ship?[/quote]

its using a div 2 and being placed near the center of the window.
Ktomislav




PostPosted: Wed Jan 13, 2010 9:27 am   Post subject: Re: trying to track my ship

It is not pic div 2, it is the hight of the picure div 2.
y+Pic.Height(pic) div 2 is Y coordinate the center of a picture.

Please ask your teacher to explain it to you because it seems that you don't understand the way this is working. By doing so you will save a lot of time to you and us and you will understand it better.
TheGuardian001




PostPosted: Wed Jan 13, 2010 9:35 am   Post subject: Re: trying to track my ship

I think you're confused about exactly what "ship" is.

"ship" is a variable turing uses to refer to a picture. This picture can be drawn any number of times in any number of locations. when you say:

code:

Draw.Oval (ship,ship,50,50,brightblue)


You are attempting to use a picture id (probably 1) as a coordinate. So you're saying to draw an oval at (1,1). "ship" does not now, nor will it ever, refer to the location of the ship. It is used only by Turing to refer to the image file you loaded.

Now, when you draw the ship itself, you use this:
code:

Pic.Draw (ship, round (x), round (y), picMerge)


The variables "x" and "y", unlike "ship" do refer to the location of the ship. Those are the coordinates of the ship in your window. If you want to know where your ship is, you should be checking those variables.
stickdude32




PostPosted: Fri Jan 15, 2010 8:37 am   Post subject: Re: trying to track my ship

well i looked at all the spot where x and y are. thing is, there real statements so i cant use them...yet
TheGuardian001




PostPosted: Fri Jan 15, 2010 8:44 am   Post subject: Re: trying to track my ship

stickdude32 @ Fri Jan 15, 2010 8:37 am wrote:
well i looked at all the spot where x and y are. thing is, there real statements so i cant use them...yet


Does that matter? They were real values when you used them to draw the ship. Use the same method you used there (It's literally exactly the same line. You can copy past that line and swap out the image name, and it would work).
stickdude32




PostPosted: Fri Jan 15, 2010 8:49 am   Post subject: Re: trying to track my ship

TheGuardian001 @ Fri Jan 15, 2010 8:44 am wrote:

Does that matter? They were real values when you used them to draw the ship. Use the same method you used there (It's literally exactly the same line. You can copy past that line and swap out the image name, and it would work).


nvm i found out that i used round to find the ship.
Sponsor
Sponsor
Sponsor
sponsor
stickdude32




PostPosted: Fri Jan 15, 2010 9:10 am   Post subject: Re: trying to track my ship

hooray it has tracked the ships position. thanks
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 2 of 2  [ 24 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: