PDA

View Full Version : A few Side-Scroller Problems



shofixti244
08-16-2007, 05:02 PM
Hey, just starting with novashell... so far I cant believe how awesome (yet free) this engine is!

Right now I'm fooling around with a side-scroller type game (think Mario) and have run into a few problems:

1: The character is really "jittery" after I apply gravity

2: When landing after a jump, the character sorta bounces backward, and acts a little to much like a rubber ball.

3: If I was to make a multiplayer mode, I would want the camera to zoom out in such a way that both characters are always visable... Any ideas on how to do this?

Also I'm Trying to switch between rotational physics (when your hit), recover (or stand back upright), and then switch to non-rotational physics... Is this possible?

Thanks in advanced!

Seth
08-17-2007, 01:04 AM
The physics code is a little shaky at the moment, the "Treeworld" demo is probably the best thing to work from for sidescrollers, if you use it as a template you should at least get results similar to that, then be very careful with changes.

I'm hoping some physics pro will look at the source and fix it sometime.. :) Or I may work with it later, but it's a bit low priority as what is there is working fine for me. (now you see why it's free ;) )



3: If I was to make a multiplayer mode, I would want the camera to zoom out in such a way that both characters are always visable... Any ideas on how to do this?


The camera can be completely controlled by script so this is possible but you'd need to calculate where to position the camera based on where the players are yourself.

So, in one of the players Update() function (that happens every frame) you could get the positions then set the camera target position and target zoom so both players will be on the screen.

The math would be like.. let's see.. add both player positions together then divide by 2 to get the average, then use GetCamera:SetPosCenteredTarget(vFinalPos); to move the camera there.

For zoom, you'd measure the distance between the two players (could use PlayerEnt:GetDistanceToPosition(theOtherPlayer:Get Pos()) to get that) and set the scale accordingly.


Also I'm Trying to switch between rotational physics (when your hit), recover (or stand back upright), and then switch to non-rotational physics... Is this possible?

It is possible to switch back and forth, the enemies in the TreeWorld example switch to rotational physics after they die for example.

shofixti244
08-17-2007, 03:25 PM
Thanks, I've solved the jittering problem by looking at treeworld, but I'm still going to need to fiddle around with bouncing.

has any other game of this type been completed in novashell?

EDIT:
Could i get a tut on how to use Vector2? i cant quite figure out how to record and use the players current X and Y.