Walking through water... a la Mystic Searches/Origins!

dale_coop

Moderator
Staff member
Ok, I used the easy way... but the result is (not perfect but) quite good:

WalkingThroughWater.gif


Made 4 animations for "water_left", "water_right", "water_top" and ""water_down", added an animation type "InWater" and assigned the animations.
Used the Action step "3", using "InWater" set the animation speed.

And made this small script to use as "Water" type tile:
Code:
;;;; If you touch this tile it will
;;;; be in water.
  CPX player1_object
  BNE finishedInWater
  GetCurrentActionType player1_object  ;; check if player was in water
  CMP #$03
  BEQ finishedInWater
  ChangeObjectState #$03, #$04      ;; uses "inWater" state.
	
finishedInWater:
 

Orgia Mode

New member
Very nice. Tell me about this line:
"ChangeObjectState #$03, #$04 ;; uses "inWater" state."

What do 03 and 04 refer to? Where are these object states located in the program?
 

dale_coop

Moderator
Staff member
The “ChangeObjectState” macro change the state (action step) of the player (the object in x)
“#$03” is the action I arbitrary choose to use for the player when is in water.
“#$04” is the "initial animation timer".
Cf the Macros.ASM script for details
 

WolfMerrik

New member
dale_coop said:
Ok, I used the easy way... but the result is (not perfect but) quite good:

It's actually very very good! And a super flexible script if you look at.
Think about this as just a ChangeObjectState Tile, and it becomes incredibly versatile, extending well beyond this purpose!

Your signature may apologize for your poor English (which is better than most of my coevals), but whats important at the end of the day is your skills in the universal language of ASM =P

Again, great post!
 

Bucket Mouse

Active member
jsherman said:
Dale, what does the game do when you want to use a weapon while in the water?

Good question. Do you want weapons dummied out or do you want them functional?

Also, where do you put this code? What comes after finishedInWater?
 

MistSonata

Moderator
Bucket Mouse said:
Also, where do you put this code? What comes after finishedInWater?

finishedInWater is just a branch that skips to the end of the code if the player is already using the water animation.

I assume you put it in an asm file and load it into your tile scripts in the project settings.
 

dale_coop

Moderator
Staff member
@jsherman : Currently it might trigger the "Attack" animation. So depends of would be my game... I would modify the script to (easiest) disable the possibllity to attack when in water or add a specific state for attack when in water (need more code).
;)

@MistSonata : exactly, made a script "InWater.asm" assigned to a "Collision Type"... then "finishedInWater:" is the end of this type tile collision, so after that... continues the normal collision code script...
 

SeaFoodAndButter

New member
dale_coop[/quote said:
If I can figure out how to put your code in my game, it will be perfect for what I need and is why I asked you about it awhile ago. If you get time, watch my vid. The dark blue "water tiles" are solid, but I have marshy sky blue water tiles that I want to be walkable, but want my player to sink a bit.

https://www.youtube.com/watch?v=lFY5lngCrJY&feature=youtu.be
 

dale_coop

Moderator
Staff member
SeaFoodAndButter: just reproduce what I explained it the first message of this topic.
Then it should work ;)
 

Wildheart_Baby

New member
Odd issue, when using the projectile out of the water it fires once and sinks the player into the ground and can't fire or move, as the player is stuck in the ground. In water it fires projectiles when you press the button.
 

dale_coop

Moderator
Staff member
Yes, I think it would be better to disabled the possibility to fire projectile when InWater.
 

dale_coop

Moderator
Staff member
dark_crow_66 said:
Dale, this is so awesome. You are really getting this coding thing.

Thank you, man.
I am still learning... by so interesting and fun to learn how to code for NESMaker.
 

stevenshepherd

New member
dale_coop said:
dark_crow_66 said:
Dale, this is so awesome. You are really getting this coding thing.

Thank you, man.
I am still learning... by so interesting and fun to learn how to code for NESMaker.


I just assumed you went into this knowing ASM! Inspiring me to step up my ASM game. I am not super motivated to yet, as I wait to see what will come along in the future that might be built into NESmaker. I am fully expecting to have to though (There is probably a 100% chance that how I want RPG battles to be initiated will require it and not be NESmaker feature).
 

dale_coop

Moderator
Staff member
In fact, I never understood ASM before, never coded anything in ASM... before NESMaker.
So I am an ASM padawan...
 

RinRem01

New member
I used this script to simulate walking through tall grass. However, once I walk into the tall grass tile my character quits walking. He looks in the directions I press, and he does the "InWater/TallGrass" animation, but he doesn't go anywhere. I copied the script word for word (I even kept it called "InWater" so I wouldn't screw up) :lol: . Any ideas? Thanks.
 
Top Bottom