Underwater physics

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
Post Reply
User avatar
Gazimaluke
Posts: 115
Joined: Fri Aug 10, 2018 7:08 am
Location: Sweden
Contact:

Underwater physics

Post by Gazimaluke » Sun Sep 09, 2018 4:35 am

I would like to have a tile type that slows down movement. Jumping in water and still moving as fast as on ground just doesn't feel great. I don't think it needs to be major slowdown just noticeable.
User avatar
WolfMerrik
Posts: 199
Joined: Sat Aug 11, 2018 4:59 pm
Location: Maine
Contact:

Re: Underwater physics

Post by WolfMerrik » Sun Sep 09, 2018 12:12 pm

Gazimaluke wrote:
Sun Sep 09, 2018 4:35 am
I would like to have a tile type that slows down movement. Jumping in water and still moving as fast as on ground just doesn't feel great. I don't think it needs to be major slowdown just noticeable.
Well, you could do this a few different ways, What I would do is, make it compares the tile type of the water if it is this tile, branch to what is basically a copy of the original gravity calculation script (to recalculate speed/etc) .
You could make new constants, like "GRAVITY_LO_WATER", "GRAVITY_HI_WATER", "MAX_VSPEED_WATER". and with using these new augmented constants, you should get a different affect.
ImageWant to download & share Image NESMaker Resources? Check out My Files on www.NESMakerFiles.com Image
User avatar
WolfMerrik
Posts: 199
Joined: Sat Aug 11, 2018 4:59 pm
Location: Maine
Contact:

Re: Underwater physics

Post by WolfMerrik » Sun Sep 09, 2018 1:15 pm

Would you want this to be a player only affect, or something that affects monsters too?

If you want this to be a status, You could look at changing an object status to be in the water.

Looking at ObjectBytesRasm.asm

Code: Select all

	Object_status .dsb 12 ; required
			;;;; bits 765 = activation/deactivation
			;;;; bit 3 = reserved for edge/random spawning, but waiting for timer
			;;;; bit 0 = "hurt and invincible" (used for recoil direction)
			;;;; bit 1 = "post-invincible hurt" (still invincible but has regained input control)
Now, we see what everything but 4 and 2 is used for... I have not done any digging, but I would assume that either of these MAY be free.
We could make a tile collision with this tile type flip one of those bits to the water state, and then compare that when calculating gravity and horizontal movement speed.

I am not sure what these bits may be used for though...

There is also something in there which I have not seen:

Code: Select all

	Object_speed_variant	.dsb 12 
I would be curious to see if this can be messed around with to make this effect work
ImageWant to download & share Image NESMaker Resources? Check out My Files on www.NESMakerFiles.com Image
User avatar
WolfMerrik
Posts: 199
Joined: Sat Aug 11, 2018 4:59 pm
Location: Maine
Contact:

Re: Underwater physics

Post by WolfMerrik » Sun Sep 09, 2018 1:27 pm

EDIT: In searching for "Object_speed_variant" - it seems to be only used in THAT file.... so I would say it is pretty safe to use this as a flag (as well as possibly other speed types)
ImageWant to download & share Image NESMaker Resources? Check out My Files on www.NESMakerFiles.com Image
User avatar
Gazimaluke
Posts: 115
Joined: Fri Aug 10, 2018 7:08 am
Location: Sweden
Contact:

Re: Underwater physics

Post by Gazimaluke » Wed Sep 12, 2018 4:56 am

WolfMerrik wrote:
Sun Sep 09, 2018 1:27 pm
EDIT: In searching for "Object_speed_variant" - it seems to be only used in THAT file.... so I would say it is pretty safe to use this as a flag (as well as possibly other speed types)
I will try it out when I get time. It would be a great effect.
Post Reply