Hello! I wonder if i have a sprite that i want to accelerate in a direction, Like if i have an airplane i want to accelerate in the direction the airplane is "pointing", so i tell the game to get some velocity in negative y direction this would make the plane go "up", but if i then turn the plane and want the plane to change direction so it always accelerate in the direction where the plane points? How do i do this? I hope you understand=) Kind regards Hey, I had problems with doing this recently and wound up putting together the following code, which does exactly what you are asking. You'll need a 50x50 png of an arrow pointing to the right in the folder. The bit you're interested in in on lines 145 and 146. I hope it helps. Spider 1 2...
views:2484 update:2012/2/13 9:11:28
If I have a table with images like this: 1 local imageTbl = {"img1.png", "img2.png", "img3.png"} i may be wrong but what you posted would just be a table with strings called "img1.png", "img2.png" and "img3.png" Hmm maybe : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 <...
views:2421 update:2012/2/13 9:11:28
I am using bitmap images (jpg) which I have to rotate (at odd angles). In the simulator (also at zoom setting which I believe corresponds to actual device size) there are jagged edges. Is this been taken care off on device (I target iPhone4 and images are in retina display size) or does one have to do something about that and, if so, what to do (the antialias setting in config is according to what I read in documentation not applicable to this)? Is there any WYSIWYG setting that shows rendering in simulator how it will look like on device where number and size of display pixels somehow match? Maybe a stupid question......
views:2485 update:2012/2/13 9:11:28
I want to load the coordinate from the text file into the table? any refer here? thanks! You can use John Beebe's library or Crawlspacelib for that. There are several other examples in the Share your code section. Like this :) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 function loadTable(fp, baseDirectory)             local path = system.pathForFile( fp, baseDirectory or system.DocumentsDirectory)                 file...
views:2272 update:2012/2/13 9:11:28
I have a piece of code that runs through a table to see if anything in that table matches. More specifically, the code checks if the current floor matches any ".floor" value in the table. The problem is, once it's checked, I'd like to delete that value from the table altogether, but I don't know how to do that. My current method doesn't work because if you run 'function selectPeople' twice, it throws and error because "persontable[i]:removeSelf()" appears to try to remove a nil value. What is the proper way to delete a value in a table completely? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 local function selectPeople(floor)     local
views:2190 update:2012/2/13 9:11:28
I have an physics object. Also, I have it set up where you press once it gets bigger, removes physics then adds back again. My problem is when new physics body being added the radius stays the same as it was. I'm trying to figure out a formula where the radius will be according to new size. Any help? Thanks The image, is it a circle or a square? If it's a circle you can grab its radius or if it is a square shape (but you want a circle body) you could set the new body radius to obj.width/2. EG; 1 2 3 4 5 6 7 8 9 10 display.setStatusBar (display.HiddenStatusBar)   -- Set up physics require ( <...
views:2252 update:2012/2/13 9:11:28
Is there a way to make physics body, but not effected by gravity? Thanks you must be new based on your question, no worries first (i'm sure you got this) add the physics local physics = require( "physics" ) physics.start() then set the gravity physics.setGravity( 0, 9.8 ) your question answer is simple, if you make you body a "static" object then it will stay and place but still be effected by collision and act like a "ground" or a "border. here is a simple "static" setting addBody "function" physics.addBody( ground, "static", { friction=0.5, bounce=0.3 } ) that should answer your question also refer to the sample app under physics labeled "hello physics" -boxie Thanks. Static won't help me here because I have that object rotating at all the time. Is there any other solution? Th...
views:2601 update:2012/2/13 9:11:28
I have read through a few topics on the API and forums about custom fonts and android. I have the following which works fine on Apple devices: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 settings = {         orientation =         {                 default = "landscapeRight",                 supported =                 {               &nbs...
views:2366 update:2012/2/13 9:11:28
trying to understand how this works.. I want to put functions in separate files and let a trigger event call them. when I put the function "justDoIt" into same file as event listener it works ok: SomeLocallyExistingDisplayObject:addEventListener("touch", justDoIt) but it does not work if I do like this: I put function "justDoIt" into file comeOn.lua. In main.lua or file with event listener: local comeOn = require ("comeOn") SomeLocallyExistingDisplayObject:addEventListener("touch", comeOn.justDoIt) Would be happy if anyone could shed some light on this:) Hi @une.ulvedal, Make sure you have: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 --make sure everything can se...
views:2520 update:2012/2/13 9:11:28
Lets say you have a series of images that regularly get added and removed from the screen depending on game characteristics (imagine for example, a control board where lights come on and off regularly). To simulate lights being on or off, new images would have to be loaded and deleted regularly based on game conditions. Would the most efficient way of handling this be? a) Deleting and adding new images as needed, when needed b) Loading all images off screen at the start (that is on coordinates that are not in the user's field of view) and then moving the image into view by changing image coordinates as needed, when needed Thanks in advance! load all of them into memory before hand use isVisible = false / true to hide show. faster than loading and deleting. keep in mind that there is a threshold as to how many images you can have on the screen ... also read <...
views:2493 update:2012/2/13 9:11:28
Page:5/987    Index Pre Next Last

corona forums © 2003-2011