Tag Info

Hot answers tagged

5

You really shouldn't use pixel coordinates for game logic. Just use coordinates that are independent of screen size, and make rendering code account for different screen sizes, this way you get much more flexible and maintainable code. So for example assume you are using 1 meter as one unit. Your screen is 2 meters high and 1 meter wide(on every device). ...


5

No. The device has an entirely different hardware than your PC and testing your App solely on the Simulator isn't going to be enough. You might hit problems in the simulator that won't occur on the device and vice versa. The simulator also doesn't simulate memory constraints of a device. I know that getting a Mac and an iPhone can be rather expensive, but ...


4

Network Architecture is difficult. The problem is your never going to get "Instantaneous" clicks on both sides. There will be some lag, and most games get around this by accepting it and building the architecture around it. For example, most first person shooters use prediction. They keep the entire game state and logic on both ends, but the server sends ...


3

With Corona SDK, you normally group things such as sprites. myGroup = display.newGroup() -- create a new group myGroup:insert(sprite1) -- insert sprite1 in it myGroup:insert(sprite2) -- insert sprite2 in it myGroup:removeSelf() -- remove everything in this group myGroup = nil -- nil the group's reference


3

I haven't debugged your code for you, so here are some bits of general advice on how to make things more robust: dirx = -dirx is a problematic way to implement bouncing, because if for whatever reason the ball is already inside an obstacle, or already moving the right direction, it will then be bounced the wrong direction and oscillate back and forth, and ...


3

First off, have you already seen Lime but don't want to incorporate that framework, since its entire purpose is to incorporate Tiled maps in Corona: http://lime.outlawgametools.com/ In your searches of the Corona forums, did you find these threads? http://developer.anscamobile.com/forum/2011/01/29/object-culling-render-process-when-not-content-area ...


2

Let me describe a bit how I do specific-height physics jumps in my current Corona game: Both the hero as well as the platforms are physics objects I put my own non-physical functionality and data on top of every sprite in the game, where needed (as I have a sprite object which mixes physics and manual behavior) When the hero runs right, I apply constant ...


2

You write code in Lua when developing in CoronaSDK. That information is definitely on their site, although it's not as prominent as it used to be (I haven't looked at the front page in a while). For example, here's the page under the "Games" heading: http://www.anscamobile.com/corona/games/ First sentence: "Built on top of OpenGL, OpenAL, Box2D, and Lua"


2

It works with more than just circles and rectangles. To be more specific, [physics.addBody()] Allows you to turn any Corona display object into a simulated physical object with one line of code, including the assignment of physical properties. The full explanation, along with examples including a rectangle, circle, and polygon, can be found here.


2

You will probably have to adjust parts of your application for the different platforms, but you won't have to do much because very little will change. Technically you can directly deploy unchanged an app created for Android onto iOS using Corona, but you will probably want to tweak a lot of things in the app in order to optimize for the different platform. ...


2

You can add an object behind another. Just add the black object (the border) first and then your main object. If you are using physics you have to set some flags so the 2 objects don't collide. Why don't you just add a sprite for your object (png, jpg) ?


2

If you don't need organization and don't need to change the display order later on, you can just do: do2:toBack() Or: do1:toFront() Now, if you want to maintain them later on, then put both do1 and do2 into a display group: doGroup = display.newGroup() doGroup:insert(do2) doGroup:insert(do1) The fact that do1 was inserted last means it will now ...


2

If do1 and do2 are in a display group they appear in the order you insert them as: local group = display.newGroup() group:insert(do1) group:insert(do2) Groups are also numerically indexed and the objects are in display order based on the index: assert(group[1] == do1) -- do1 is on the bottom assert(group[2] == do2) -- do2 is on the top (front) If you ...


2

These are 100% tiles/sprites or whatever. Noone draws that kind of detail with code. Also it is not isometric, this is isometric: The grid in your example seems to be a simple top-down square grid. Here is another example of a 2D top down square grid: Do you see the difference? Here is a great tutorial series to creating a game in that style: ...


2

Make the values that define your physics body variables, not hard coded values. Then you can scale them at the same time you scale the sprite for your cake. The easiest way is to move your hard coded values into an array, then loop through the array and scale the values the same as the sprite before creating the physics object. An alternative, likely ...


2

From my limited knowledge and research, you seem to be incorrect in application of the force from the explosion. My above comments discuss this further, but put simply, you should not be applying a uniform force of {300, 300} to all bodies, unless you want to hurl them at a 45-degree angle with the same amount of force. If you want a realistic explosion, you ...


2

I have worked with Corona Labs (creators of the Corona SDK) as a contractor for almost 2 years now and I can safely tell you that the majority of these issues have been resolved - Android performance has taken a lot of work to improve but it is at the stage now it's very, very solid and the threads from 18 months ago, 12 months ago and even 6 months ago can ...


2

I don't think this is possible, since apps are built only via the Corona client application - your source actually gets sent to Corona's server where it is built, then sent back to you as a packaged application. See Building your App using Corona for more info.


2

Basically you will want to do something like this: deltaX = event.x - playerX deltaY = event.y - playerY normDeltaX = deltaX / math.sqrt(math.pow(deltaX,2) + math.pow(deltaY,2)) normDeltaY = deltaY / math.sqrt(math.pow(deltaX,2) + math.pow(deltaY,2)) ... bullet:setLinearVelocity( normDeltaX * speed, normDeltaY * speed )


2

No, Corona does not build for web platforms.


2

Gimp Script-Fu You can batch resize images with Gimp thanks to scripts. You should probably look at some tutorials since it doesn't look very simple. Here is an example of batch resize, and here is an example that keeps aspect ratio. The intro is in french, it basically means: Here is an example of script that resize the current image to a 600 pixels ...


1

The easiest approach is to have separate "card instance" objects from "card template" objects. A deck then is a collection of card instances, and each instance references its template. Something like: class CardTemplate { uuid id; string name; int base_hp; }; class CardInstance { CardTemplate template; int current_hp; }; This has ...


1

Try using newImageRect() instead of newImage() image_variable_name = display.newImageRect("testimage.jpg", display.contentWidth, display.contentHeight) --then you have to center it: image_variable_name.x = display.contentWidth / 2 image_variable_name.y = display.contentHeight / 2


1

No. You have two options. Firstly, you can remove the image and then request the next one. display.remove(itemImage) itemImage = nil local myOtherImage = display.newImageRect() If you call the old image again later, this is fine as the images are cached by Corona. Secondly, you can use an image sheet: display.remove(imageItem) itemImage = nil local ...


1

Well, is difficult to answer you question because is too wide. But here are the basics on each framework, as far as i know at least xD SDL - no idea, never used cocos2d-x - is basically a c port (has other options) from cocos2d-iphone. The main feature is cross platform, and they take this seriously, trying to provide support for every mobile OS out ...


1

Aha! Figured it out! The problem has to do with the collision event being thrown multiple times as things balance out physics wise (as it should be). My collision handler being what it was, the "prepare" step would keep getting called, setting the animation to the first frame, until the collision events stopped firing. My fix was to write a little state ...


1

When you call obj:removeSelf(), it removes corona metatable from object and remove it from display hierarchy. But the object is not completely removed after this, it becomes a simple lua table {}. So you must set it to nil, to the garbage collector deleted it completely. You can change your listener to this: local function showTextListener(event) if ...


1

Try this: function acc:accelerometer(e) boy:applyLinearImpulse(e.yGravity, .5, 0, 0) end This huge if statement looks terrible and is definitely the wrong way to be handling your problem, whatever that is. However, you don't describe your problem at all, you don't explain this code (would like to know what exactly are the parameters for ...


1

If you are using any features exclusive to iOS (like Game Center) then you would have to modify that code accordingly, however that is the extent of any real modifications. In config.lua you could specify the scaling, however "letterbox" is the default and usually works the best across all devices, so you can ignore this unless you would like to use a ...



Only top voted, non community-wiki answers of a minimum length are eligible