Hi all!
I explored löve 1 week ago and I'm very happy with it
I will ask my questions here, in this thread. Now I just have one:
SCROLLING
I am a newbie at game dev, but I did some simple stuff in C++ with SDL. Basically you can copy surfaces, or part of them on top of other surfaces. I had a big "game world" surface and I cut out screensized pieces of it and basically scrolling was done.
But you can't copy surfaces (images) on top of each other in Löve, so I can't make the big "world surface".
How should I make scrolling here? Please help me.
löve newbie has some questions
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: löve newbie has some questions
The easiest way of doing that is using an offset:
Further, there are a lot of games on this forum you can look at, to see how they did something.
Good luck and welcome.
Code: Select all
love.graphics.draw(image1, image1_x - offset_x, image1_y - offset_y)
love.graphics.draw(image2, image2_x - offset_x, image2_y - offset_y)
Good luck and welcome.
Help us help you: attach a .love.
Re: löve newbie has some questions
thanks
wow it is really great that basically if you download a game you can inspect the source
wow it is really great that basically if you download a game you can inspect the source
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: löve newbie has some questions
It certainly is.OUT wrote:wow it is really great that basically if you download a game you can inspect the source
Help us help you: attach a .love.
Re: löve newbie has some questions
teehee!
I found the orgasmic CAMERA class!
p.s. the wiki is awesome as well
I found the orgasmic CAMERA class!
p.s. the wiki is awesome as well
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: löve newbie has some questions
I must tell you that with the coming release of 0.6.0 CAMERA is becoming near-obsolete, for my own game I've decided on dropping it when I get around to it.
Re: löve newbie has some questions
I see, thanks for the tip
anyway I have a new problem:
as a first project, today I made PONG. Good learning experience.
The top and the bottom of the screen are shapes of a static body in the physics world.
The player walls are also shapes of static bodies, if the players push their buttons, I modify their positions with body:setPosition().
There is only 1 dynamic object, the ball itself.
The problem is when there is the serving phase, I randomize the starting velocities of the ball, I set these with body:setvelocity().
The ball won't move at all UNLESS I set gravity in the physics world, which obviously is just PLAIN BAD in this game. I dont want any gravity!
I got to set the gravity at least ~ (0, 1) or the ball won't move at all. I made the program print out the randomized and current velocity values of the ball. If there is no gravity, it will print that the ball has for example a velocity = -120, 70 but it won't move at all.
Could someone explain this to me?
anyway I have a new problem:
as a first project, today I made PONG. Good learning experience.
The top and the bottom of the screen are shapes of a static body in the physics world.
The player walls are also shapes of static bodies, if the players push their buttons, I modify their positions with body:setPosition().
There is only 1 dynamic object, the ball itself.
The problem is when there is the serving phase, I randomize the starting velocities of the ball, I set these with body:setvelocity().
The ball won't move at all UNLESS I set gravity in the physics world, which obviously is just PLAIN BAD in this game. I dont want any gravity!
I got to set the gravity at least ~ (0, 1) or the ball won't move at all. I made the program print out the randomized and current velocity values of the ball. If there is no gravity, it will print that the ball has for example a velocity = -120, 70 but it won't move at all.
Could someone explain this to me?
- Attachments
-
- pingpong.love
- Here is the pong game
- (5.9 KiB) Downloaded 311 times
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: löve newbie has some questions
This is not directly related to gravity. You see, what I think has happened is that the ball "fell asleep". You need to call :setSleep(false) on the body at the start of every update. In LÖVE 0.6.0 you will be able to just call :setAllowSleep(false) on the body once after it is created.
Help us help you: attach a .love.
Re: löve newbie has some questions
wow thanks for the fast answer ! this forum is cool.
now i can go to sleep with this stuff being solved
now i can go to sleep with this stuff being solved
Re: löve newbie has some questions
I'll just consider this thread to be a reason for me not to post a new thread asking a newbie question.
Does anyone have a simple example of basic collision? I just need something to give me an idea of how it works, so I kind implement it into my own code.
Does anyone have a simple example of basic collision? I just need something to give me an idea of how it works, so I kind implement it into my own code.
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests