Use physics with tile map object?

Get help using Construct 2

Post » Wed Jan 01, 2014 5:02 am

The gameplay I am wanting to recreate is that of Solar Jetman on the NES. Here is a link

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!farmerdwight2014-01-01 18:25:01
B
10
S
3
Posts: 102
Reputation: 1,888

Post » Wed Jan 01, 2014 12:37 pm

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
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Jan 01, 2014 12:53 pm

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Jan 01, 2014 2:42 pm

@RamPackWobble

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'.farmerdwight2014-01-01 14:47:33
B
10
S
3
Posts: 102
Reputation: 1,888

Post » Wed Jan 01, 2014 5:26 pm

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
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Jan 01, 2014 5:37 pm

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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jan 01, 2014 5:41 pm

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jan 01, 2014 6:20 pm

@LittleStain

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.
B
10
S
3
Posts: 102
Reputation: 1,888

Post » Wed Jan 01, 2014 6:58 pm

use the custom movement, on overlap push out solid opposite angle. maybe you should set the speed also, but it should work.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jan 01, 2014 7:10 pm

Tilemap works properly with physics in r155.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Next

Return to How do I....?

Who is online

Users browsing this forum: 25games, brunopalermo and 9 guests