Page 1 of 1

Multiple questions

Posted: Sat Dec 10, 2011 3:25 pm
by Joliplex
Hi all.

I have multiple questions.

1) Have anyone played Ortho Robot? (http://www.stabyourselfnet/orthorobot)? There is a music switch. How can I made my music change like it?
2) How to warp player (if he goes off the screen, he'll come back of the opposite side)?
3) How to make a trail like here (non-löve, sorry): http://www.youtube.com/watch?v=mTALu0Mr ... re=related
4) What is that weird OBEY everyone haves?

Thanks again!

Re: Multiple questions

Posted: Sat Dec 10, 2011 3:38 pm
by Jack5500
I can't answer all questions, but I try my best:

2) Fizz, had a warpy thingy. Here's the code, but I don't know if it's working right off or if you need the fizz.lua

Code: Select all

player.x, player.y = player.x%800, player.y%600
4) What wreid Obey?

Re: Multiple questions

Posted: Sat Dec 10, 2011 3:38 pm
by runyonave
I can only answer a couple of your questions:

Player warping
To do that, you can set an if statement like so:

Code: Select all

-- moving RIGHT
if player.x > SCREEN_WIDTH then
      player_x = 0

-- MOVING LEFT
if player.x < 0 then
       player.x = SCREEN_WIDTH

-- moving UP
if player.y < 0 then
       player.y = SCREEN_HEIGHT

-- moving DOWN
if player.y > SCREEN_HEIGHT then
       player.y = 0
Why does everyone have obey? I'm new here too, still don't know why. Hehe.

Re: Multiple questions

Posted: Sat Dec 10, 2011 3:42 pm
by Metalcookie
Hey,

1) Haven't played it, but I see you can download the source code (the .love file) at the bottom of the page you linked.

2) Something like this:

Code: Select all

if player.x < 0 then                            --if he goes off the left edge..
	player.x = love.graphics.getWidth()          --put him back at the right edge!
elseif player.x > love.graphics.getWidth() then --but if he goes off the right edge..
	player.x = 0                                 --put him back at the left edge!
end
if player.y < 0 then                            --if he 'falls off' the screen..
	player.y = love.graphics.getHeight()         --put him back at the top!
elseif player.y > love.graphics.getHeight() then--if he flies off the top of the screen..
	player.y = 0                                 --put him back at the bottom!
end
where player.x and player.y are the player's coordinates.
You'll have to fiddle with it a bit so it'll take the image of the player itself into account as well.

3) Particles (http://love2d.org/wiki/ParticleSystem)

4) Magic.

EDIT: 15000th post in Support and Development, I can has cookie now?

Re: Multiple questions

Posted: Sat Dec 10, 2011 5:27 pm
by coffee
Joliplex wrote: 4) What is that weird OBEY everyone haves?
http://love2d.org/forums/viewtopic.php?f=3&t=9

Re: Multiple questions

Posted: Sat Dec 10, 2011 7:47 pm
by Taehl
1) Nope.
2) The fastest way would be to use modulo math on the player's coordinates:

Code: Select all

love.update(dt)
	player.x, player.y = player.x % 800, player.y % 600
end
3) ParticleSystem
4) What do you mean?