|
|||||||
| Forum Home | Register | Members List | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | ||||||||
|
Member
Location: N. America |
Ohk..I've been banging my head for quite some time now..ghrr..im messing somewhere with the scrolling logic..
Here is what i do: Code:
//From Player.cs
if (ScreenX - world.ViewPortX >= Constants.viewPortWidth / 2)
world.ViewPortX++;
else if (ScreenX - world.ViewPortX < (Constants.viewPortWidth / 2) - 1)
world.ViewPortX--;
It scrolls correctly for some part, but it stops scrolling when I reach the end of the screen. Any ideas, how can I improve upon the scrolling logic ? Also, I have attached my code in .zip format |
||||||||
|
|
|
|
|
#12 | ||||||||
|
Junior Member
Location: Seattle WA |
I have a couple questions for this competition:
1) How much scrolling does our background have to have for this competition? 2) Would it be ok to make more of a SHMUP/platformer hybrid of sorts for this, or will that make judging to difficult (ie., apples and oranges) ? really, they're the same question... just phrased differently. thanks -chris
__________________
my gamedev blog |
||||||||
|
|
|
|
|
#13 | ||||||||
|
Senior Member
Location: London |
In response to the scrolling question: Some scrolling, but how much is up to you. if you want a shmup platformer you can providing there is some scolling involved.
brainydexter: I've had a quick look at your code. The reason it's stopping is because you're clamping the maximum and minimum X position of your player object to the width of the play area. If you remove the clamping, the environment scrolls continuously (which is I assume what you want). The problem you have then is that your player moves faster than the environment so you'll need to tweak the updateScrollingFrame() method so that your player cannot escape the play area. |
||||||||
|
|
|
|
|
#14 | |||||||||
|
Moderator
Location: Netherlands |
Quote:
These sets can of course consist of a single enemy or object, and not all sets need to scroll—'though most of them usually do.
__________________
I'm a web developer by profession, but a game developer by heart. Uh oh! The princess is in another signature! |
|||||||||
|
|
|
|
|
#15 | |||||||||
|
Member
Location: N. America |
Quote:
In order to display the entire map, I have to increment the viewport with 8, so that the player can scroll through the whole width of the map. Now, as soon as I increment the viewport by 8, each time it hits this logic, it really scrolls too fast, which looks very wierd. Thereon, if I have to scroll left, and using the above said logic, if I decrement the viewport by 8, the logic really goes crazy. Lastly, if I increment by 8, the condition goes for a toss: Code:
ScreenX - world.ViewPortX >= Constants.viewPortWidth / 2 ![]() |
|||||||||
|
|
|
|
|
#16 | ||||||||
|
Senior Member
Location: London |
I think a couple of things that account for the 'weirdness' are:
The way I would handle your view position & player movement would be to store & update the player position as you are currently doing - this indicates your character's "World position". Next update the viewport position to always display your character in the centre of the viewport (so Code:
Viewport.x = player.Position.x - (Viewport.width / 2) Now when you draw your character it's screen position would be Position.x - Viewport.x. Similarly to start rendering your level you will want to find out which the left-most tile will be with something along the lines of: Code:
int tileIndex = (Viewport.X / TileWidth) % NumberOfHorizontalTilesInLevel |
||||||||
|
|
|
|
|
#17 | ||||||||
|
Member
Location: N. America |
Thanks Claxon. It really dawned upon me as to what you were saying and I fixed the code. It scrolls now, all the way till the end
![]() I am now working on collision detection. Lets see how this one goes ![]() Thanks a ton ! |
||||||||
|
|
|
|
|
#18 | ||||||||
|
Member
Location: Tuckahoe, NY |
Hey guys, just wanted to give an update on how things are going. Right now I have the ability to show graphics using DirectX9, which is something that I couldn't do before so I'm somewhat moving on this. Now I need to get my ship to fire weapons and get a background in there to really give it some life. I had difficulty with collision detection with the pong game hopefully I won't have that this time. I'll keep you guys updated.
|
||||||||
|
|
|
|
|
#19 | ||||||||
|
Member
Location: N. America |
I just posted a new FAQ section on my blog. If anybody else is also struggling with the scrolling part, they can check the FAQ section. Also, just shout if any bit of it is not clear
![]() Hope it is of some use to the reader. (Also, this is my first time at doing such things, thus if you have any sorts of suggestions, let me know.) |
||||||||
|
|
|
|
|
#20 | ||||||||
|
Senior Member
Location: London |
Cool, I can see that FAQ being useful for newbies if you keep adding to it.
|
||||||||
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 09:57 PM.





























Linear Mode

