teeter-totter / platform / Board / spinning propeller

Can someone explain to me or show me a small example of:

An object or character running / rolling across across a board that turns like an airplane propeller when the object character goes across it.

I guess the middle of the board would be some type of pivot point or something, I am just not sure.

Thanks in advance

Larry M
DoubleSlashDesign.com
[import]uid: 11860 topic_id: 13872 reply_id: 313872[/import]

Look at the flight simulator code, they have it so when a plane lands down a certain air strip, it disappears.

You could change that so when you character moves across a certain part in the screen, you turn your propeller.

have a look at this code for making something spin, like a propeller.

[code]
– WINDMILL

local physics = require(“physics”)
physics.start()
physics.setDrawMode( “hybrid” ) – normal, hybrid, debug

local anchor = display.newCircle( 0,0,5 )
anchor.alpha = .1

physics.addBody( anchor, “static”, { friction=0, bounce=0, density=0 } )

local hub = display.newCircle( display.contentCenterX, display.contentCenterY, 40 )
physics.addBody( hub, “dynamic”, { friction=1, bounce=.1, density=3, radius=40 } )
hub.fixture = physics.newJoint( “pivot”, anchor, hub, hub.x, hub.y )

local tap = function( event )
local ball = display.newCircle( event.x, event.y, 20 )
physics.addBody( ball, “dynamic”, { friction=1, bounce=.1, density=1, radius=20 } )
function ball:timer( event )
if (ball.y > 1500) then
timer.cancel( ball.t )
ball.t = nil
ball:removeSelf()
end
end
ball.t = timer.performWithDelay( 10000, ball, 3 )
end

local addarm = function( hub, rot )
local arm = display.newRect( 0, 0, 20, 100 )
arm.x, arm.y = display.contentCenterX, display.contentCenterY - 80
physics.addBody( arm, “dynamic”, { friction=1, bounce=.1, density=1 } )
arm.connect = physics.newJoint( “weld”, hub, arm, hub.x, hub.y )
hub.rotation = hub.rotation + rot
end

for i=1, 4 do
addarm( hub, 90 )
end

hub.fixture.isMotorEnabled = true
hub.fixture.motorSpeed = 20
hub.fixture.maxMotorTorque = 40

Runtime:addEventListener( “tap”, tap )

[/code] [import]uid: 68741 topic_id: 13872 reply_id: 50969[/import]

@notts_forest_

Wow, I accidently came across this looking for something else. That is pretty sweet. I had an obstacle in a ball based game I was making and I was trying to get it to react the way it does like you have it. This is perfecto!

ng. [import]uid: 61600 topic_id: 13872 reply_id: 50981[/import]

I think you pretty much answered my question.

This sample is great thanks so much.

I’ll put it to good use. :slight_smile:

Larry M DoubleSlashDesign.com [import]uid: 11860 topic_id: 13872 reply_id: 51023[/import]