Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: megane on April 06, 2010, 10:25:29 PM

Title: controlling scene with mouse
Post by: megane on April 06, 2010, 10:25:29 PM


Hello All,


I searched on forum and documantation.Also i tried alot of methods.but i couldnt do it :)

İ can move scene by keyboard like this

on "Keypress"
{
 
 
if (Scene.CanHandleEvent("Keypress")) Scene.ApplyEvent("Keypress");



switch(Keyboard.KeyCode)
{
case VK_UP:

      Scene.SkipTo(posX, posY-50);
     posY=posY-50;
     break;
    
case VK_DOWN:

      Scene.SkipTo(posX, posY+50);
     posY=posY+50;
     break;

case VK_LEFT:

      Scene.SkipTo(posX-50, posY);
     posX=posX-50;
     break;
    
case VK_RIGHT:

      Scene.SkipTo(posX+50, posY);
     posX=posX+50;
     break;

}

i can move scene with left click like this

on "LeftClick"
{

Scene.SkipTo(Scene.MouseX, Scene.MouseY);
}



But i cant move scene by mouse over :(

What should i do ?




Best Regards.
Title: Re: controlling scene with mouse
Post by: metamorphium on April 06, 2010, 10:55:48 PM
Put this to the end of your scene_init.script file for the scene in question.

Code: WME Script
  1. while (1)
  2. {
  3.    Sleep(60);
  4. }
  5.  
Title: Re: controlling scene with mouse
Post by: megane on April 06, 2010, 11:17:34 PM
Put this to the end of your scene_init.script file for the scene in question.

Code: WME Script
  1. while (1)
  2. {
  3.    Sleep(60);
  4. }
  5.  



Oh really thanks!

I hope that to solve this engine ,i liked it :)

Title: Re: controlling scene with mouse
Post by: megane on April 08, 2010, 09:47:48 AM


Hello ,


İ have different problem.Your code works but so fastly ,also my keyboard code doesnt work with this?
Actually i want to move my scene with mouse over but i couldnt it.
if there is a sample game for this based WME , Can you tell me? i can understand well with a sample.



Best Regards.
Title: Re: controlling scene with mouse
Post by: metamorphium on April 08, 2010, 11:09:32 AM
hello,

it was just an example of the principle, not meant to be a working game code. AFAIK there's no game yet with working direct mouse control.
Title: Re: controlling scene with mouse
Post by: megane on April 09, 2010, 12:41:18 PM


This is bad :)

I have idea. background entity has mouse over.. right?
when i came to over backgorund.skipto scene..something like this.. maybe it work.
Can i access backgorund with mouse over?
Title: Re: controlling scene with mouse
Post by: metamorphium on April 09, 2010, 01:10:47 PM
please rephrase. I totally don't understand what are you trying to achieve. If you wrote that more clearly, I might be able to help you better.
Title: Re: controlling scene with mouse
Post by: megane on April 09, 2010, 05:14:23 PM


Sorry my english is very crazy :)

Which things can i access with MouseEntry event?
for example: can i access background entity? actors?

if it is possible, it might be usefull for me.


Thanks again.
Title: Re: controlling scene with mouse
Post by: metamorphium on April 09, 2010, 06:26:22 PM
what do you mean by "access". Can you tell me a little use case. (eg. "actor stands in the scene, if I place the mouse cursor over it, he dies" :))
Title: Re: controlling scene with mouse
Post by: megane on April 09, 2010, 06:44:38 PM


yes true.. i meant something like your example.
Title: Re: controlling scene with mouse
Post by: metamorphium on April 09, 2010, 07:00:51 PM
then it's standard behavior. Attach a script to your entity in scene editor. In this script write:

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. on "MouseEntry"
  4. {
  5.     Game.Msg("Your mouse entered this entity");
  6. }
  7.  
  8.  
  9. on "MouseLeave"
  10. {
  11.     Game.Msg("Your mouse exited this entity");
  12. }
  13.  
  14. on "LeftClick"
  15. {
  16.     Game.Msg("Your mouse clicked this entity");
  17. }
  18.  

make sure your entity is set to interactive in Scene Editor.