I have a box image, and I want to constrict the players movement to the boundries of that box. How do I do this?
More specifically, I'd like some tutorials on level design in LOVE. is it just a matter of using the draw function to put png's and gifs into the map, or what?
the game I'm attempting to make is top down. below is an image of the map I want to make in LOVE:
constricting movement
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: constricting movement
Well, it all depends on how you do it, if you're using Box2D expect a lot of work, if you aren't you just have to check if there is supposed to be something in the direction of movement (like a boundary) and just don't update the movement (so it stops). About the graphical part it's just drawing the obstacles, but it's best to have collision and images at the same positions.
If you're using Box2D, you have to update Box2D each frame (makes sense)and for every update you have you have to create a shape. (the docs are most helpful on this, I can't explain any better)
If you're using Box2D, you have to update Box2D each frame (makes sense)and for every update you have you have to create a shape. (the docs are most helpful on this, I can't explain any better)
Re: constricting movement
the way i constricted the movement (and wrapped it) was to check if the player coordinates were greater than the game size (you use the size of the box)
for instance:
that wraps the movement so the player appears on the other side of the screen (like the later versions of snake on mobiles)
for instance:
Code: Select all
if player:getX() > box:getWidth then
player:setX(0)
end
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
Re: constricting movement
you can view this post:
http://love2d.org/forum/viewtopic.php?f=5&t=715
and see how i make the level, with mappy and tolua.lua export utility.
the boxes to constrict movement are done with the level size...
it's ok for you?
http://love2d.org/forum/viewtopic.php?f=5&t=715
and see how i make the level, with mappy and tolua.lua export utility.
the boxes to constrict movement are done with the level size...
it's ok for you?
Who is online
Users browsing this forum: Bing [Bot], DOMINOSRULZ and 91 guests