# Use physics with tile map object?

0 Favourites
• 11 posts
• The gameplay I am wanting to recreate is that of Solar Jetman on the NES. Here is a

Subscribe to Construct videos now

I'm wanting to have realistic collision with a tilemap object.

I have a spaceship flying around and a tilemap object that shows a mountain.

I've tried giving the tilemap a solid behavior and my ship a bullet behavior. This gave me a good bouncing collision effect. However, the bullet behavior wasn't good for my ship because when the ship changed direction, the ship would instantly start moving in the new direction rather than continue to drift in the original direction and gradually accelerate to the new direction.

I've also tried giving the ship a physics behavior 'moveable' and the tilemap a physics behavior 'immovable'. However, my ship collides with the very outer rectangular bounds of the entire tile map rather than just colliding with the mountain. I'm not sure why the ship would collide with the entire tilemap because i've deleted all the tiles that are not a part of the mountain. But the ship still sees the empty tile space as part of the tilemap.

Are there any other ways of going about doing this? Thanks and Happy New Years!

• Rather than using the bullet bounce off solids why not just check for it being:-

overlapping the mountain ?

slow it down.

is it slow enough ?

change direction

accelerate

• Thanks for the reply! That second example looks pretty close to what I need. Unfortunately, I already stated that the bullet property doesn't work for the ship because it doesn't provide for a realistic looking motion. The ship should be able to look like it is floating out in space. Then accelerate in one direction, turn around 180 degrees and continue to float in the same direction. Then start to accelerate until it comes to a stop and then start moving forwards.

With the bullet property, the ship is always moving at a speed in the direction it is facing.

I can make the illusion that the ship is able to rotate freely while not changing direction but superimposing another sprite on top of the real ship and rotating that around. But when I want to move the real sprite underneathe, the movement looks unreleasitic when it instantly changes direction without any 'drifting' or 'sliding'.

• In that case I suggest you look at custom movement.

Here is a quick test I tried that might help. Arrow keys rotate you/boost and break.

https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/spaceships%20over%20mountains%20test%2002.capx

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Sounds like you want to recreate the spaceship movement from asteroids. Instead of reinventing the wheel, maybe you should take a look at this tutorial:

Asteroids tutorial

• Appreciate the thought LittleStain but that Astroids game is missing half of what I am wanting to do. In that game, when the ship collides with an astroid, it just plows through the astroid. There is no rebounding whatsoever. And the astroids are individual sprites and not a stationary object like my mountain.

The movement of the ship is too easy to recreate. The difficulty comes with having realistic ricocheting off stationary objects that are comprised of a tilemap.

• use the custom movement, on overlap push out solid opposite angle. maybe you should set the speed also, but it should work.

• Tilemap works properly with physics in r155.

• Yes you are right of course! After upgrading to r155, my original program still didn't work right which I guess is because it was created in r152 so I remade it in r155 and it works! Thanks