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 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
stickdude32




PostPosted: Tue Jan 05, 2010 9:04 am   Post subject: trying to track my ship

What is it you are trying to achieve?
collision on the ship and shooting lasers from the front


What is the problem you are having?
cant 'locate' the ships position


Describe what you have tried to solve this problem
drwing a circle at the ships variable

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
4.1



group space game.t
 Description:

Download
 Filename:  group space game.t
 Filesize:  3.07 KB
 Downloaded:  101 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
stickdude32




PostPosted: Tue Jan 05, 2010 9:15 am   Post subject: RE:trying to track my ship

or do u guys need the pics as well?
DemonWasp




PostPosted: Tue Jan 05, 2010 10:29 pm   Post subject: RE:trying to track my ship

To actually run your program, yes, we would need the pictures as well.

That said, I think the reason that using "ship" to draw the oval isn't working is because "ship" refers to the picture ID of a rotated ship image.
mirhagk




PostPosted: Wed Jan 06, 2010 8:10 am   Post subject: RE:trying to track my ship

I'd suggest using a type to store all the ship variables for instance
Turing:

var ship :
    record
        x, y : int
        pic : int
    end record

that would record the position and the pic id of the ship. Of course you would wanna add more to it so that it stores ALL the ships data but that should get you started.
stickdude32




PostPosted: Wed Jan 06, 2010 8:43 am   Post subject: Re: RE:trying to track my ship

DemonWasp @ Tue Jan 05, 2010 10:29 pm wrote:
To actually run your program, yes, we would need the pictures as well.

That said, I think the reason that using "ship" to draw the oval isn't working is because "ship" refers to the picture ID of a rotated ship image.


there u go. u can delete those startup stuff.



laser.bmp
 Description:
 Filesize:  8.65 KB
 Viewed:  3110 Time(s)

laser.bmp



shipmove.bmp
 Description:
 Filesize:  8.13 KB
 Viewed:  3110 Time(s)

shipmove.bmp


stickdude32




PostPosted: Wed Jan 06, 2010 8:49 am   Post subject: Re: RE:trying to track my ship

mirhagk @ Wed Jan 06, 2010 8:10 am wrote:
I'd suggest using a type to store all the ship variables for instance
Turing:

var ship :
    record
        x, y : int
        pic : int
    end record

that would record the position and the pic id of the ship. Of course you would wanna add more to it so that it stores ALL the ships data but that should get you started.


thing is... i didn't learn about record. all i was taught was normal movement, puting things at certain places and making a high low game. i learned about the music and other small stuff. so i tried to figure the things of an asteroid game.
stickdude32




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

heres the complete folder.


game.zip
 Description:

Download
 Filename:  game.zip
 Filesize:  6.42 MB
 Downloaded:  498 Time(s)

stickdude32




PostPosted: Mon Jan 11, 2010 8:38 am   Post subject: Re: trying to track my ship

im running out of time to finish this. Sad
Sponsor
Sponsor
Sponsor
sponsor
stickdude32




PostPosted: Mon Jan 11, 2010 8:46 am   Post subject: Re: RE:trying to track my ship

stickdude32 @ Wed Jan 06, 2010 8:49 am wrote:
mirhagk @ Wed Jan 06, 2010 8:10 am wrote:
I'd suggest using a type to store all the ship variables for instance
Turing:

var ship :
    record
        x, y : int
        pic : int
    end record

that would record the position and the pic id of the ship. Of course you would wanna add more to it so that it stores ALL the ships data but that should get you started.


thing is... i didn't learn about record. all i was taught was normal movement, puting things at certain places and making a high low game. i learned about the music and other small stuff. so i tried to figure the things of an asteroid game.


nvm, i figured it out...slightly
Ktomislav




PostPosted: Mon Jan 11, 2010 8:59 am   Post subject: Re: trying to track my ship

X coordinate of the lower left corner of the ship is variable x, y coordinate of the lower left corner of the ship is variable y.
X coordinate of the upper right corner of the ship is variable x+Pic.Width(ship), y coordinate of the upper right corner of the ship is variable y+Pic.Height(ship).

Is that what you wanted?
stickdude32




PostPosted: Tue Jan 12, 2010 8:48 am   Post subject: Re: trying to track my ship

Ktomislav @ Mon Jan 11, 2010 8:59 am wrote:
X coordinate of the lower left corner of the ship is variable x, y coordinate of the lower left corner of the ship is variable y.
X coordinate of the upper right corner of the ship is variable x+Pic.Width(ship), y coordinate of the upper right corner of the ship is variable y+Pic.Height(ship).

Is that what you wanted?


i dunno i fiddled around with that but it didnt quite work i way i thought it would. could you put into a code that goes with the file.
Euphoracle




PostPosted: Tue Jan 12, 2010 9:42 am   Post subject: RE:trying to track my ship

Why can't you put it into code? :S

Save the position of your ship from moveShip to a variable you define at the top of your program and then you can 'locate' it anywhere.

Ktomislav's post refers to 'collision detection'. Basically, if you know where the ship is located on the screen (your original question) in terms of x position and y position, and you know the height and width of the image (Turing has functions for this), then you can check if two squares are within the bounds of each other using math (as described in the Turing Tutorial forum).

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Ktomislav




PostPosted: Tue Jan 12, 2010 9:51 am   Post subject: Re: trying to track my ship

Also you don't use sprites correctly because you define variable ship as
a picture, but use it as a sprite.
stickdude32




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

Euphoracle @ Tue Jan 12, 2010 9:42 am wrote:
Why can't you put it into code? :S

Save the position of your ship from moveShip to a variable you define at the top of your program and then you can 'locate' it anywhere.

Ktomislav's post refers to 'collision detection'. Basically, if you know where the ship is located on the screen (your original question) in terms of x position and y position, and you know the height and width of the image (Turing has functions for this), then you can check if two squares are within the bounds of each other using math (as described in the Turing Tutorial forum).


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.
stickdude32




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

this is the code of it now.


game.zip
 Description:

Download
 Filename:  game.zip
 Filesize:  6.42 MB
 Downloaded:  188 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 2  [ 24 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: