![]() ![]() Iâll share my results but first, I would like to ask how to update my Corona SDK as you mentioned? I tried re-downloading from Corona SDK home page but same build number as to what I posted. Hi XeduR you for the response, I appreciate it. I also added a few extra steps to the bottom of the function since you need to release focus and set isFocus to false once you are done to prevent bugs. These would be easy to calculate manually too. Seems like xDelta and yDelta are undocumented atm. local function f\_planeTouchEvent( im\_event ) if ( im\_event.phase = "began" ) then -Lets the program focus on the touched object display.getCurrentStage():setFocus( im\_event.target, im\_event.id) im\_ = true -Store the original X and Y values of touched object im\_ = im\_ im\_ = im\_ elseif ( im\_event.phase = "moved" ) then -Object was moved/dragged if ( im\_ ) then im\_ = im\_ event.xDelta im\_ = im\_ event.yDelta end else display.getCurrentStage():setFocus( im\_event.target, nil ) im\_ = false end end the measure of how far the touch event has moved) and add those to the shipâs original coordinates, i.e. Youâll get the correct movement if you use delta x and y (i.e. This means that the ship will jump wherever you touch. Your issue seems to be that you are setting the coordinates for your ship based on the event.x and event.y. You should update to the latest daily build. If this is already solved from other post/sites. ![]() If there are things that I forgot to include, please let me know. Apologies as I am not a native English speaker. Let me know if there are statements that are confusing in my post. ![]() Simulation views encountered: All devices The plane should still be at the bottom part with movement imitating my swipe Start of simulation, image is at the bottom partĪs I swipe the upper part, the plane character teleported to where I swiped. Simulation (please see attached image for visualization ) Ĭurrent code chunk: local function f\_planeTouchEvent( im\_event ) if ( im\_event.phase = "began" ) then -Lets the program focus on the touched object display.getCurrentStage():setFocus( im\_event.target, im\_event.id) im\_ = true -Store the original X and Y values of touched object im\_ = im\_ im\_ = im\_ elseif ( im\_event.phase = "moved" ) then -Object was moved/dragged if ( im\_ ) then im\_ = im\_event.x im\_ = im\_event.y end end end -\ ld\_s\_plane:addEventListener( "touch", f\_planeTouchEvent) I came across to this topic and gave it a try. Most tutorials Iâve searched in Google is either Plane fighter with D-pad controller or the character should be dragged (event.target during run time) The design is to move the character by swiping anywhere on the screen. The Plane character âteleports to the swiping positionâ Var marksFound = findMarkX(image, 100, 20) ĬodeImage.data = new Buffer(codeImage.width*codeImage.height*4) įor ( var y=0 y ![]() THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES Purpose with or without fee is hereby granted, provided that the aboveĬopyright notice and this permission notice appear in all copies. Permission to use, copy, modify, and/or distribute this software for any ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |