Sunday 14 August 2011

Mouse Input

This flowgraph shows a simple example that you can increase or decrease the height of a box by holding your mouse (hold left mouse key to increase, and right mouse key to decrease). The height increases/decreases gradually as you hold the key; it stops when you release the key.


Sunday 7 August 2011

Click to Move Objects


I’ve just created a flowgraph which moves objects when left click the mouse (to the spot where you clicked on).


1.       When mouse hovers on an object, the outline of object will be silhouetted [HUD: SihouetteOutline];

2.       At the meantime, it shows message “You are about to move XXX (Name of Object)” [String: Combine] & [HUD: ShowHUDMessage];

3.       Click on somewhere in the scene, and the object will move towards to that spot; [Input:Mouse] &  [Movement: MoveEntityTo];

4.       When it arrives the destination, it shows the message: “XXX (Name of Object) has been moved to ….(Coordination)” [String: Combine] & [HUD: ShowHUDMessage];

5.       If click again, the object will move to the new destination; if mouse hovers another object à GO TO STEP 1.

Hints:

1. You may enable modal mode either by a link (as shown in the graph), or by hitting a key on the keyboard. You may set up the key in "Input:Mouse ->Modal mode key". By default it is Number key "0";

2. You may change the parameter "DisableMovement" in "Input:Mouse" to "fause" (0), so that the character would be able to move in the game;

3. In the "Movement: MoveEntityTo" module, change the "Speed" to a reasonable value (I made it 0.5). Objects won't move if it is "0", as set by default;

4. In the "Movement: MoveEntityTo" module, if "DynamicUpdate" is ture (value = 1), then the selected object will move towards wherever the mouse icon is, regardless you click or not; if it is faulse (value = 0), it will only move each time you click; 

5. The Entity Id to the "Movement: MoveEntityTo" module should be the "LastEntityID" from the "Input: Mouse" module.