Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

use standart physics
Started by wwwref Feb 26 2016 02:30 PM

1 reply to this topic
shysics
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

wwwref

[GLOBAL: userInfoPane.html]
wwwref
  • Observer

  • 1 posts
  • Corona SDK

Hi everyone.
I just started to learn corona.
How i can use standard physics?
i try

 

local physics = require( "physics" )
physics.start()
mte.toggleWorldWrapX(true)
mte.toggleWorldWrapY(true)
local map = mte.loadMap("map/Level0.tmx")
local blockScale = 20
local locX = 44
local locY = 79
mte.setCamera({locX = locX, locY = locY, blockScale = blockScale})
local worldScaleX = mte.worldScaleX
local worldScaleY = mte.worldScaleY
--CREATE PLAYER SPRITE -----------------------------------------------------------------
local SpriteSheet = graphics.newImageSheet("player.png",{width = 45, height = 45, numFrames = 26})
local SeqenceData = {
{ name = "stand", sheet = SpriteSheet, frames = {18, 19, 20, 21}, time = 1500, loopCount = 0}
}
local player = display.newSprite(SpriteSheet, SeqenceData)
local setup = {layer = 2, kind = "sprite", locX = locX, locY = locY,
levelWidth = 32, levelHeight = 32, offsetX = 10, offsetY = -10
}
local mapObj = mte.getMapObj()
local layer = 1
physics.addBody( mte.getMapObj(), "static", { friction=0.5, bounce=0.3 } )
physics.addBody( player, { density=3.0, friction=0.5, bounce=0.3 } )
mte.addSprite(player, setup)
mte.moveCamera(0, -40) --place camera above the sprite to improve the view
mte.setCameraFocus(player)
mte.update()
player:setSequence("stand")
player:play()

 

but there is no collision checking =(

 

is possible, or can use only physics MTE?

 



[TOPIC: post.html]
#2

greg brady

[GLOBAL: userInfoPane.html]
greg brady
  • Contributor

  • 283 posts
  • Corona SDK

physics works fine in MTE.




[topic_controls]
[/topic_controls]