The Daily Click ::. Forums ::. Klik Coding Help ::. Have screen wrap around the play area - scrolling problem
 

Post Reply  Post Oekaki 
 

Posted By Message

Nickey



Registered
  16/11/2009
Points
  9
6th January, 2010 at 16:45:00 -

I am a noob and trying my hand at making my first game. It is a space shooter with my spaceship always centred in the middle of the play area. I have made a minimap with enemy objects and everything is working fine and the scrolling is working - My problem is - when I reach the edge of my screen(map), my spaceship no longer stays centred, but moves right to the edge of the screen - How do I make the map always scroll (My spaceship always in the middle). You know - having the map kinda loop or wrapping itself around the play area.

Hope I am clear enough and hopefully you guys can help me out.

Thanx in advance


 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
6th January, 2010 at 16:51:34 -

you either need levels of a set length with an ending, or you need to scroll everything around the player and not actually move the player (in whatever direction the game scrolls, horizontal, vertical). if you move the environment you can have an infinite playfield, possibly randomly generating obstacles and enemies off screen and moving them towards the player.

 
n/a

Nickey



Registered
  16/11/2009
Points
  9
6th January, 2010 at 17:02:57 -

Thanks for the quick reply.

Moving the environment sounds exactly what I need. But I'm not sure how. Any tutorials you can recommend? Or a hint maybe?

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
6th January, 2010 at 17:40:35 -

give each thing a speed. and always move it (horizontally or vertically, whichever direction the shooter is going) that ammount.

say if i have an object 'asteroid' and it has a horizontal speed of 3 stored in its alt value a.

always set X('asteroid') == X('asteroid') + alt value a('asteroid')

Edited by Cecilectomy

 
n/a

Nickey



Registered
  16/11/2009
Points
  9
6th January, 2010 at 18:11:40 -

Thank you.

I pretty much get it now. Although it seems like it will be one heck of a job if you intend on having loads of objects.
I will; however, give it a whirl, else I will just be content with having an end to the map.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
6th January, 2010 at 19:26:05 -

There is another way to "fake" looping and still use scrolling.

Here's a little example:

http://www.jsoftgames.com/loopingplayfield.zip

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
6th January, 2010 at 21:28:31 -


Originally Posted by Nickey
Thank you.

I pretty much get it now. Although it seems like it will be one heck of a job if you intend on having loads of objects.
I will; however, give it a whirl, else I will just be content with having an end to the map.



Couldn't you put use behaviors and copy the behavior to each object you want to wrap?

 
http://www.facebook.com/truediamondgame

Nickey



Registered
  16/11/2009
Points
  9
7th January, 2010 at 21:14:49 -

Thank you for all the replies and help.

As soon as I get to it, I will let you know what the outcome was.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
7th January, 2010 at 23:46:36 -


Originally Posted by UrbanMonk
There is another way to "fake" looping and still use scrolling.

Here's a little example:

http://www.jsoftgames.com/loopingplayfield.zip

this assumes the exact same circumstances at the end of the map as the beginning (somewhat improbably when you are also dealing with enemies and other obstacles, not just fluid backdrops), otherwise it will have a teleporty effect (a kind of jerk when you loop back the the beginning).

Edited by Cecilectomy

 
n/a

Nickey



Registered
  16/11/2009
Points
  9
9th January, 2010 at 13:53:22 -

I have checked out the example of UrbanMonk, but the sequence of the objects does not work out quite well then - so far I will either stick with having an end to the map.

I just need to check out the last "fake" loop from Ebenezer Cecil

Thank you for all the replies.

Edited by Nickey

 
n/a

Nickey



Registered
  16/11/2009
Points
  9
9th January, 2010 at 13:58:51 -

Sorry Ebenezer Ceci, the link seems to be dead.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
9th January, 2010 at 14:39:10 -

uhhh. no. that link was in a quote. it was urbanmonks link. i was just quoting him.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click