I am planning to design a 2D distance game, which is someone hit a ball and see how far the ball can goes
But the thing is, in order to make the ball move,
- should i make the ball static and scroll the background?
- or should the camera follow the ball and the ball move after force applied
which one is the proper way to do it? And also, i cant determine how far the ball can goes, so it should be unlimited scrolling till the ball drop and stop
and also, is it possible to PAUSE the game, and during the halt time, apply some animation and RESUME the game and change the ball force?
i am quite Noob in game dev but i found this engine quite easy to use compare to those C++ or Java, and the community quite supportive
Thanks for all the helps
Scroll Tile Infinity times for a platform game
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Scroll Tile Infinity times for a platform game
The second of your options seems the most sane.
As for your other question, sure its possible. You could, for example, give your ball a state. When the state is "flying", run some code to make it move further along its path, when the state is "paused", run some code to run that animation, etc.
As for your other question, sure its possible. You could, for example, give your ball a state. When the state is "flying", run some code to make it move further along its path, when the state is "paused", run some code to run that animation, etc.
Re: Scroll Tile Infinity times for a platform game
hi nevon, thanks for the reply but correct me if i am wrong.
there is no pause function provided in the framework?
there is no pause function provided in the framework?
Re: Scroll Tile Infinity times for a platform game
weilies wrote:hi nevon, thanks for the reply but correct me if i am wrong.
there is no pause function provided in the framework?
Code: Select all
paused=false
function love.run()
if love.load then love.load() end
-- Main loop.
while true do
love.timer.step()
if love.update and not paused then love.update(love.timer.getDelta()) end --Yay!
love.graphics.clear()
if love.draw then love.draw() end
-- Process events.
for e,a,b,c in love.event.poll() do
if e == 'q' then
if love.audio then
love.audio.stop()
end
return
end
love.handlers[e](a,b,c)
end
love.timer.sleep(1)
love.graphics.present()
end
end
Hello, I am not dead.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Scroll Tile Infinity times for a platform game
@zac352: That helps.. well, no, like not at all, way to get your post count up...
On-topic:
Correct, because that's not what you want to do either, you want to use states (which are generally useful in games). Basically you save a variable saying what state it is, and then you act according to what it says, so if you're paused, you stop updating physics, and draw that animation.
On-topic:
Correct, because that's not what you want to do either, you want to use states (which are generally useful in games). Basically you save a variable saying what state it is, and then you act according to what it says, so if you're paused, you stop updating physics, and draw that animation.
Re: Scroll Tile Infinity times for a platform game
I wasn't trying to up my post count.. You could actually use that. Somewhat.bartbes wrote:@zac352: That helps.. well, no, like not at all, way to get your post count up...
Hello, I am not dead.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Scroll Tile Infinity times for a platform game
It's not very helpful or useful. The only way to get out of the pause is by means of keypress, mouse click, etc. It's very inflexible, plus it has a custom love.run, which isn't really recommended for beginners either.zac352 wrote:I wasn't trying to up my post count.. You could actually use that. Somewhat.bartbes wrote:@zac352: That helps.. well, no, like not at all, way to get your post count up...
Almost every time you post something here, you manage to annoy bartbes, me, and other members of this community. Please, think before you post.
Help us help you: attach a .love.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Scroll Tile Infinity times for a platform game
Hi weilies,
There is no 'stop everything' function because you almost never really want that to happen.
On a normal game, pausing doesn't really mean 'stopping everything'. For example:
You do something similar with love.draw.
The issue with this approach is that it doesn't expand very well. Sooner you will want to have a in_main_menu variable, an in_options_menu variable, etc. And your code will look like this:
Your love.update and love.draw functions will get very big, very fast.
If you are interested, I've developed a tool that simplifies the managing of 'game states'; It's called MindState. On that wiki page you can see an example of how to use it as a game controller.
There is no 'stop everything' function because you almost never really want that to happen.
On a normal game, pausing doesn't really mean 'stopping everything'. For example:
- You still want music to go on (if you are playing music)
- You want a 'pause menu' to appear... and the elements on that dialog should not be affected by the pause!
Code: Select all
local paused = false
function love.update(dt)
if paused then
... show / handle the pause dialog
else
... update the 'normal' game
end
end
The issue with this approach is that it doesn't expand very well. Sooner you will want to have a in_main_menu variable, an in_options_menu variable, etc. And your code will look like this:
Code: Select all
function love.update(dt)
if paused then
... show / handle the pause dialog
elseif in_main_menu
... show the main menu
elseif in_options_menu
... show the options menu
...
else
... update the 'normal' game
end
end
If you are interested, I've developed a tool that simplifies the managing of 'game states'; It's called MindState. On that wiki page you can see an example of how to use it as a game controller.
When I write def I mean function.
Who is online
Users browsing this forum: No registered users and 2 guests