What is the purpose of "Object_movement"?

User avatar
cargo
Posts: 54
Joined: Mon Sep 03, 2018 4:34 am

What is the purpose of "Object_movement"?

Post by cargo » Mon Nov 05, 2018 11:24 pm

If gamepad holds the NES controller's state, then what does Object_movement contains?
(Just trying to understand the underlying code)
User avatar
chronosv2
Posts: 204
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: What is the purpose of "Object_movement"?

Post by chronosv2 » Tue Nov 06, 2018 12:40 am

Object_movement is the direction an object is set to move. It's what tells the physics engine "This object is moving right."
That's why hold/press a direction sets a bit in that variable and releasing the button unsets the bit.
User avatar
dale_coop
Posts: 1465
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: What is the purpose of "Object_movement"?

Post by dale_coop » Tue Nov 06, 2018 7:14 am

Joe made some great videos about that, on Vimeo:
https://vimeo.com/276741403
And all his old videos (it was about the beta):
https://vimeo.com/joegranatoiv
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
cargo
Posts: 54
Joined: Mon Sep 03, 2018 4:34 am

Re: What is the purpose of "Object_movement"?

Post by cargo » Tue Nov 06, 2018 3:50 pm

Thanks. I will add the video to my things to watch.
But unlike gamepad (which is a single variable) Object_movement points to a table array. Is this correct?
User avatar
chronosv2
Posts: 204
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: What is the purpose of "Object_movement"?

Post by chronosv2 » Tue Nov 06, 2018 5:49 pm

The array is for each object in the object RAM.
For example, Object_movement,0 gets the movement data from the object in slot 0. Object_movement,4 gets the movement info for the object in slot 4.
From the comments in the StartMoving Macro:

Code: Select all

	;; This macro uses the built in physics found in default physics scripts.
	;; Which observes acceleratoin and deceleration as long as bounds and tile collision.
	;; It is not a direct movement, but rather turns on a check for whether or not
	;; the object should move.
	
	;; Keep in mind, this does not alter the facing-direction of the object, just
	;; the actual motion.
	
	;constant definitions for direction are:
		;MOVE_RIGHT = #%11000000
		;MOVE_LEFT  = #%10000000
		;MOVE_DOWN  = #%00110000
		;MOVE_RIGHT = #%11000000
		;MOVE_LEFT  = #%10000000
		;MOVE_DOWN  = #%00110000
		;MOVE_UP    = #%00100000
		;               +--------Bit 7 is yes or no to h movement
		;                +----------- if 1, bit 6 is L (0) or R (1)
		;                 +------Bit 5 is yes or no to v movement
		;                  +--------- if 1, bit 4 is U (0) or D (1)
		;DIAGONALS:
		;MOVE_RIGHT_DOWN = #%11110000
		;MOVE_LEFT_DOWN  = #%10110000
		;MOVE_RIGHT_UP	 = #%11100000
		;MOVE_LEFT_UP	 = #%10100000
User avatar
cargo
Posts: 54
Joined: Mon Sep 03, 2018 4:34 am

Re: What is the purpose of "Object_movement"?

Post by cargo » Tue Nov 06, 2018 7:12 pm

Are constant definitions interchangeable with those for gamepad values?
User avatar
chronosv2
Posts: 204
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: What is the purpose of "Object_movement"?

Post by chronosv2 » Tue Nov 06, 2018 9:07 pm

No. Gamepad is different. It's a variable called "gamepad".
I believe the order of the bits in that variable are Right, Left, Down, Up, Start, Select, B, A
So Up+A would be #%00010001, for example.
Making constants for all the possible (legal) controller combinations would take a lot of constants. It's easier just to remember that bit order and work from that to check for certain controller combinations.
User avatar
cargo
Posts: 54
Joined: Mon Sep 03, 2018 4:34 am

Re: What is the purpose of "Object_movement"?

Post by cargo » Wed Nov 07, 2018 2:27 am

chronosv2 wrote:
Tue Nov 06, 2018 9:07 pm
No. Gamepad is different. It's a variable called "gamepad".
Well thank you Mr. Obvious.
Making constants for all the possible (legal) controller combinations would take a lot of constants. It's easier just to remember that bit order and work from that to check for certain controller combinations.
I never said button combinations. I was just wondering if the directional constant values used for obejct movement still matched those read from the gamepad. I'll figure it out on my own.
User avatar
chronosv2
Posts: 204
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA
Contact:

Re: What is the purpose of "Object_movement"?

Post by chronosv2 » Wed Nov 07, 2018 4:47 am

GameEngineData\Routines\UserScripts\[Module]\MovementScripts
Figure it out from there.
Sorry my attempts to assist you were clearly insufficient. Good luck.
User avatar
dale_coop
Posts: 1465
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: What is the purpose of "Object_movement"?

Post by dale_coop » Wed Nov 07, 2018 7:16 am

cargo wrote:
Wed Nov 07, 2018 2:27 am
I was just wondering if the directional constant values used for obejct movement still matched those read from the gamepad. I'll figure it out on my own.
No it doesn’t! And chronosv2 shown an example (with the combinaisons).
The object_movement value contains informations for the direction mouvement AND informations of its facing directions... of the Player. The gamepad contains just the informations of the buttons actually pressed. Here, nothing about the player!
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply