moving / rotating an object
Author |
Message |
freally
|
Posted: Sun Apr 27, 2008 8:56 pm Post subject: moving / rotating an object |
|
|
okay, for a school program, i have to draw an object, or thing, or w/e using the drawline/drawbox/drawoval/drawarc tools, and i have to use all of em atleast once, so i decided to make a stick figure golfing (cuz i like golf)...I had no problem drawing the golfer, but I wanted him to actually swing the club, but am having trouble, rotating the actual club face.. .its kinda hard to explain, but i'll copy the code to here... I got the club shaft to move, but the club face doesn't rotate like i want it to...any ideas?
heres the code...not efficient, cuz i'm still learning turing, and programming..but i am liking wat i have done so far ...
i've also tried a couple of things, so my code is kinda messy atm..but w/e here it is:
%golf_stick_figure
var x:int:=125
var y:int:=45
var z:int:=0
var r:int:=125
put "Hole 1: Par 5 - 495 Yards"
setscreen ("offscreenonly")
loop
%ground
drawfillbox (0, 0, 350, 25, green)
%unmoved body
drawline (75, 25, 125, 125, black)
drawline (175, 25, 125, 125, black)
drawline (125, 125, 125, 250, brightblue)
%club
exit when x= 15
drawline (x, y, 125, 140, gray)
x:=x -1
y:=y + 1
if z< 115 then
z:=z+1
r:= r +1
end if
if z= 100 then
z:=z
end if
drawline (r+z, y, r-z, y, grey)
%face
drawfilloval (125, 300, 50, 50, black)
drawfilloval (145, 320, 10, 10, white)
drawfilloval (145, 320, 5, 5, black)
drawfilloval (105, 320, 10, 10, white)
drawfilloval (105, 320, 5, 5, black)
drawfillarc (125, 283, 25, 10, 180, 0, white)
%tee, ball
drawfillbox (135, 25, 140, 30, brown)
drawfilloval (137, 37, 7, 7, white)
%arms and hands
drawline (125, 230, 75, 180, brightblue)
drawline (75, 180, 125, 140, black)
drawline (125, 230, 175, 180, brightblue)
drawline (175, 180, 125, 140, black)
drawfilloval ( 125,140 , 5, 5, black)
delay (100)
View.Update
cls
colorback (195)
end loop
ty, for anyone who helps |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Tallguy

|
Posted: Mon Apr 28, 2008 8:06 am Post subject: RE:moving / rotating an object |
|
|
connect the club 'foot' thingy to the xy of the end of the actual club, tell it to move at the same speed etc. also use a if statement to stop the club at a certain height ('cause ur if statement an't working, y do u have a cls and a View.Update > they cancell each other out
srry buts its a little hard to explain wat u have to do, and i can't do it for u its ur own project |
|
|
|
|
 |
freally
|
Posted: Mon Apr 28, 2008 2:53 pm Post subject: Re: RE:moving / rotating an object |
|
|
Tallguy @ Mon Apr 28, 2008 8:06 am wrote: connect the club 'foot' thingy to the xy of the end of the actual club, tell it to move at the same speed etc. also use a if statement to stop the club at a certain height ('cause ur if statement an't working, y do u have a cls and a View.Update > they cancell each other out
srry buts its a little hard to explain wat u have to do, and i can't do it for u its ur own project
how do i attatch it to the xy and tell it to move at the same speed, etc.?
just by making, the first 2 points of the face of the club xy as well? cuz that didn't seem to work :S
btw, i'm just doing this as an extra sort of thing, thats not part of the drawing objects part |
|
|
|
|
 |
|
|