I am trying to figure out the best way to organize my program to include a controllable character.
Should my character sprites by included in a separate layer in tiled?
How can I act on bodies once they have been loaded into lime? Say for example, if I wanted to make one of the boxes in tutorial 3 jump when I tapped the screen. Would I give that tile a special name in the properties, then every time I wanted it to jump, I would loop through all the tiles to see which tiles had that property and then do something like this to the tile or body:
Also, I’ve been able to add a sprite w/a dynamic physics body to the end of tutorial 7 (just using physics.addBody to the scene. For what ever reason this new sprite will collide with the static platforms but not the falling tiles.
Anybody have any ideas or sample code I can look at while I try and figure things out/wait for the next tutorial.
Thanks in Advance,
Mike
[import]uid: 12267 topic_id: 4487 reply_id: 304487[/import]
For the character sprites, I would have them on a layer by themselves, this may not be the best way (and certainly not the only way) it is just the way I would do it. This is so that you can then have correct z-depth layering of things such as foreground and background items.
Rather than looping through all the tiles on every tap to check for a property, you could use the Object Listener stuff to create your jumping crates, that way on every creation you would be able to store off a reference to the objects.
As far as the dynamic physics object goes, it might be to do with collision filters if you have those set, other wise feel free to email me the map file (and any tileset images etc and code) and I will gladly take a look at it for you. [import]uid: 5833 topic_id: 4487 reply_id: 14071[/import]
I got my character into the scene moving around. I made a new layer and added “character” as one of my tile properties in TILED. It is animating a jumping around. Very cool.
I was wondering a few things:
Is it currently possible to set the shape of a physical body associated with a tile? I know this is possible in corona, but wasn’t sure if it was implemented in lime yet. I either want to make the body shape a circle or a complex polygon.
Is there a maximum file size that can be loaded with lime/corona? I am trying to load in a character that is about 3 tiles wide by 2 tiles high. Each tile is 64x64.
Something I noticed when loading in my large character images in Tiled: The way they are initially positioned in lime is different than how they appear in Tiled. The position is close. I think it might be an issue with how lime initially lays out the scene if things added aren’t multiples of the grid size?
When using the new 0.2 beta version, after my character got a certain distance down the map, the sprite texture disappeared but the physics body stayed the same.
I also forgot to say, you must remember that the X and Y position of an Object in tiled is actually its TopLeft position, so for instance if you use it to set the position of an image like this -
local onObject = function(object)
local test = display.newImage("Guy.png", object.x, object.y)
end
The image will seem out of place as you have told it where its top left corner should be rather than the centre, to set the centre position you should do this instead -
[code]
local onObject = function(object)
local test = display.newImage(“Guy.png”)
test.x = object.x
test.y = object.y
end
I have just uploaded a new version of the code (check the Beta updates thread for the link) as well as a new tutorial to go along with it - http://justaddli.me/tutorial.php?t=0&id=8
You can now have circular bodies as well as ones built from a single shape, multiple shapes are coming soon. [import]uid: 5833 topic_id: 4487 reply_id: 14175[/import]
Whoops, my bad. Again Was to eager to get the code out and forgot to set a single value back to true
Please download the updated lychee.lua here - http://dl.dropbox.com/u/571145/lychee.lua - and just overwrite the previous one with it. [import]uid: 5833 topic_id: 4487 reply_id: 14189[/import]
map moves now in sync with physics , however after moving a screen and a half to the right, new bg tiles don’t show up. Quick fix: drag physics .3 into beta build .1 [import]uid: 12267 topic_id: 4487 reply_id: 14190[/import]
Ok thanks, I think I many know what is causing the problem but not sure of the solution yet, could you send me your project file so that I can reproduce the error? [import]uid: 5833 topic_id: 4487 reply_id: 14191[/import]
There are a few things that I don’t understand about Lime that could help take it to the next level:
an example of how to use listeners to detect a collision between the character and the ground objects.
This could help me prevent the problem of “double jumping” in a platformer
some help on making my physics bounding box match the shape of the character(s). I tried to apply the latest physics tutorial to a tile, instead of an object, with no luck.
Is it possible to add all of the animals to one container object, and then rotate the container object and the position of each animal, instead of repositioning large sprites over and over again?
Really enjoying not having to get super dirty in code, thanks to Lime.
Thanks for all the work,
Mike [import]uid: 12267 topic_id: 4487 reply_id: 14286[/import]
Glad to see it is progressing and that you are enjoying Lime along the way while also finding ways to improve things!
I think that sounds like a great idea for a gameplay-specific tutorial, I will do that one very soon.
I think you will want to read (once it’s ready) the next physics tutorial, as that will show you how to use multiple shapes to build up your physics body.
You could add all your objects a group and then rotate that, something like this: