Object movement
Author |
Message |
nate
|
Posted: Sun Mar 30, 2003 7:37 pm Post subject: Object movement |
|
|
I have a shooting game and I wan't the target to move not only side ways but also up and down at the same time. Can someone please post the code to do this.
And I was also wondering if there is a code for a pic that moves from left to right but also rotates. If so could you please post it!!
Thanks
-Nate |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Blade
|
|
|
|
|
nate
|
Posted: Sun Mar 30, 2003 8:17 pm Post subject: (No subject) |
|
|
Blade wrote: theres a tutorial on character control here...
http://www.compsci.ca/bbs/viewtopic.php?t=114
NOO!!!!!!!!!!!
I don't want to control the picture. I wan't it to be moving automatically.
ANIMATION!!! (basically)
please reply with the right answer!
thanks
-NAte |
|
|
|
|
|
Asok
|
Posted: Sun Mar 30, 2003 8:20 pm Post subject: (No subject) |
|
|
You need to be more specific nate. With what you've described I'd say the same thing. To move side ways and up and down at the same time would be to move diagonally. Or do you mean you want the user to be able to switch axis ie go up then go left.
To get a picture to rotate use the Pic.Rotate command. (works only in Turing v4.x) |
|
|
|
|
|
nate
|
Posted: Sun Mar 30, 2003 8:43 pm Post subject: (No subject) |
|
|
Asok wrote: You need to be more specific nate. With what you've described I'd say the same thing. To move side ways and up and down at the same time would be to move diagonally. Or do you mean you want the user to be able to switch axis ie go up then go left.
To get a picture to rotate use the Pic.Rotate command. (works only in Turing v4.x)
Thanks but could you expand more on the Pic.Rotate. The way they explain it in the Turing Reference guide is hard to understand. Do you mind or anyone else mind expanding on the Pic.Rotate . Like how to make a picture move from 1 side of the screen to the other while rotating.
code: |
View.Set ("graphics:300;250,nobuttonbar")
var pic : array 0 .. 35 of int
var f : int := Font.New ("Serif:36")
const CTR : int := 57
Font.Draw ("Hello", 5, 45, f, black)
Draw.FillOval (CTR, CTR, 3, 3, brightred)
pic (0) := Pic.New (0, 0, 115, 115)
cls
for angle : 1 .. 35
pic (angle) := Pic.Rotate (pic (0), angle * 10, CTR, CTR)
end for
var x : int := CTR
var y : int := CTR
var dx : int := 1
var dy : int := 1
loop
for angle : 0 .. 35
Pic.Draw (pic (angle), x CTR, y CTR, picCopy)
if x + dx < CTR or x + dx > maxx CTR then
dx := dx
end if
if y + dy < CTR or y + dy > maxy CTR then
dy := dy
end if
x += dx
y += dy
delay (50)
end for
end loop
|
This makes the word HELLO rotate and move from left to right but I don't understand what they are doing!!
Thanks
-Nate |
|
|
|
|
|
Blade
|
Posted: Sun Mar 30, 2003 9:44 pm Post subject: (No subject) |
|
|
wow, i feel really loved when i try to help someone... who isnt being very specific with what he wants... |
|
|
|
|
|
Tony
|
Posted: Sun Mar 30, 2003 9:50 pm Post subject: (No subject) |
|
|
there're 2 forloops
1st creates a bunch of pictures rotated at different angles
2nd loop draws different pictures at different locations, making it looks like its moving and rotating. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
williamblake621
|
Posted: Wed Jan 18, 2012 12:16 am Post subject: Re: Object movement |
|
|
how do you rotate the pictures easily, sounds little different ! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Beastinonyou
|
Posted: Wed Jan 18, 2012 8:17 am Post subject: Re: Object movement |
|
|
Is it just me, or is every other thread in the Help section Necro'd old threads now? |
|
|
|
|
|
|
|