Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2/4/11
#1
  • Tool picking up/dropping works again, and
  • Tools are now dropped where you are pointing instead of on your head
  • getAngle() member function for tools; this returns the angle between the player's body and the mouse
  • moveTo(position, part) member function for models. The specified part will be moved to the given position, and the other parts in the model will be moved with it.

Here is an example of getAngle(). Put this script in a tool, then click to throw balls.

Code:
player = script.Parent.Parent.Parent
character = player.Character
body = character.Body
link(script.Parent.MouseDown, function(b)
    if b == 1 then
        local a = math.rad(script.Parent:getAngle()) --it returns degrees, we need radians to use sin and cos
        local x = math.cos(a) --get the x and y components of the angle
        local y = math.sin(a)
        local position = Vec2D(body.Position.x + x * 4, body.Position.y + y * 4) --Position of the ball
        local p = create("Circle")
        p.Position = position
        p.Velocity = Vec2D(x * 20, y * 20) --Give it some velocity
        p.Color = Color(200, 0, 0)
        p.Parent = game.World
    end
end)
Reply
#2
Thats cool, thanks for sharing with us Jacob!
Reply
#3
God. The type of scripting on this site is CONFUSING!
Reply
#4
Does this page make it any clearer? http://buildism.net/wiki/w/index.php?tit...pting_Help
Reply
#5
(02-06-2011, 10:56 PM)Jacob_ Wrote: Does this page make it any clearer? http://buildism.net/wiki/w/index.php?tit...pting_Help

Yes. Big Grin thanks Smile
Reply
#6
Next update will be a tutorial of some sort.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)