Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by GlergHendershmidt

Hello,

I'm a JavaScript developer, but new to Impact and to game dev in general. I'm trying to make a top down game where a tank drives around a map. The tank should stay in the center of the screen and the map should scroll. I've looked through the forums and found similar questions, but most seem concerned with a more advanced effect -- allowing the player to move to some degree until it gets near the edge. I've seen the examples that show how to use the camera class, etc. along these lines...

But my question is more basic for me to get started. What is the best way to make a large map and have it scroll while the player is stationary in the center? Do I make a layer in Welmeister that has larger dimensions? If so, how do I get it so that it starts in the middle of the map as opposed to having the top left corner at 0,0. How should I place the player entity? What is the best way to scroll the map? Are there different common approaches and if so what are the pros and cons? If I put collision boxes on the map, will it prevent scrolling of the map when they hit the player in the same way that a moving player would be stopped if it hit a stationary collision box?

Thanks!

Glerg

1 decade ago by StuartTresadern

Create a large map in Weltmeister . You can then use setScreenPos to move the visible window of the map http://impactjs.com/documentation/class-reference/backgroundmap#setscreenpos

Spawn your player and then use the setScreenPos to centre the player on the screen. You will need to stop stop the screen scrolling and also handle the collisions.

Dominic's camera classes in the forums will do the job you just need to remove the trap and damping. This will centre the camera on the Player and take care of the scrolling for you also because the camera is tracking the player the collisions will prevent the camera from moving if the player can not move.

http://impactjs.com/forums/help/screen-scrolling#post1978

1 decade ago by GlergHendershmidt

Thanks a lot! Will try it out.
Page 1 of 1
« first « previous next › last »