Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - SOLO

Pages: 1 [2]
16
Technical forum / Can I run this flashlight script within a window
« on: April 12, 2012, 12:04:59 PM »
Hi Wintermutes,
                       I have this flashlight script that runs great for a scene but I need it to work over a window.

Is this possible?


Here is the flashlight script -


#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
// a scene region the darkness is going to be stuck to
// create a dummy region and move it to the bottom of the scene nodes in SceneEdit
var ForegroundRegionName = "foreground";


// two images to build the darkness/flashlight overlay
var DarkImage  = "flashlight\dark.png";
var LightImage = "flashlight\light2.png";


// dimensions of the above images
var TileWidth  = 200;
var TileHeight = 200;


// transparency of the "darkness"
// set to 255 for solid black
var Alpha = 180;





////////////////////////////////////////////////////////////////////////////////
// setup
var MainLayer = Scene.MainLayer;

var NumTilesWidth  = MainLayer.Width  / TileWidth  + 2;
var NumTilesHeight = MainLayer.Height / TileHeight + 2;

Initialize();

var LastPosX = -100;
var LastPosY = -100;


////////////////////////////////////////////////////////////////////////////////
// main loop
while(true)
{
   // postion of the light   
   
   Update(Scene.MouseX, Scene.MouseY);
   //Update(actor.X, actor.Y - actor.Height);
   
   Sleep(100);
}


////////////////////////////////////////////////////////////////////////////////
function Update(PosX, PosY)
{
   if(PosX==LastPosX && PosY==LastPosY) return;
   
   LastPosX = PosX;
   LastPosY = PosY;
   
   var LightX = ToInt(PosX / TileWidth + 1);
   var LightY = ToInt(PosY / TileHeight + 1);
   
   var Ent;
   var OffsetX = PosX - Math.Floor(PosX / TileWidth) * TileWidth + TileWidth / 2;
   var OffsetY = PosY - Math.Floor(PosY / TileHeight) * TileHeight + TileHeight / 2;


  for(var j = 0; j<=NumTilesHeight; j=j+1)
  {
    for(var i = 0; i<=NumTilesWidth; i=i+1)
    {
       Ent = Scene.GetNode(i + "-" + j);
         
       var NewSprite;
       if(i==LightX && j==LightY) NewSprite = LightImage;
       else NewSprite = DarkImage;
       
       if(Ent.GetSprite()!=NewSprite) Ent.SetSprite(NewSprite);
       
       Ent.X = (i - 2) * TileWidth  + OffsetX;
       Ent.Y = (j - 2) * TileHeight + OffsetY;
    }
   }

}


////////////////////////////////////////////////////////////////////////////////
function Initialize()
{
  for(var j = 0; j<=NumTilesHeight; j=j+1)
  {
    for(var i = 0; i<=NumTilesWidth; i=i+1)
    {
       var Ent = Scene.CreateEntity(i + "-" + j);
       Ent.X = (i - 1) * TileWidth;
       Ent.Y = (j - 1) * TileHeight;       
       Ent.Scalable = false;
       Ent.Colorable = false;
       Ent.Interactive = false;
       Ent.SetSprite(DarkImage);
       Ent.AlphaColor = MakeRGBA(255, 255, 255, Alpha);
       Ent.StickToRegion(ForegroundRegionName);
    }
  }
}

Can someone help please?

Many thanks

Regards

Solo



17
Scripts, plugins, utilities, goodies / Re: Sierra right click interface
« on: November 15, 2011, 03:13:24 PM »
Rocco,
          Great example but how would I implement this with the basic demo menu?
What I mean is I have an actor on screen and the normal mouse pointer and when I press the RIGHT mouse button the MENU appears initially and then RIGHT clicking afterwards moves through the actions - LOOK, TAKE etc

Can this be done?

All I get is errors or it does not work, is this because of the loop?

Many thanks

18
Technical forum / Re: Window animating cube?
« on: November 11, 2011, 05:23:43 PM »
Spellbreaker thanks for the info, but I do not want the player to click anywhere.

I want them to open the MENU by a RIGHT CLICK - Done no problem

This shows a square with the first selection - TAKE

Then as the player moves the cursor LEFT/RIGHT the window plays a sprite which depicts the square rotating to the next option - ACTION

and then onto OPTIONS and then onto LOOK.



It is getting the window to understand that if my mouse pointer reaches the edge of the window -SQUARE that it plays a sprite to rotate the square that I am having issues with.



To activate the option displayed will be the LEFT click as normal.




Hope this explains it alittle clearer.  ;D

19
Technical forum / Re: Window animating cube?
« on: November 10, 2011, 12:12:48 PM »
 ::wave

42 views and no replies?  :'(

Anyone done anything like this for a main GUI menu in WME?


20
Technical forum / Window animating cube?
« on: November 09, 2011, 12:47:10 PM »
Hi,
    I think this is possible but need a little help, I have a window (main MENU window) which looks like a square (cube) what I want to achieve is that on each face of the cube is a menu option - TAKE, LOOKAT, ACTION, OPTIONS

So to start, the player when he opens the menu sees the square (cube) - TAKE then When the player moves the cursor to the right side of the cube a sprite will play that makes it look like the cube is turning and then the next face shows -LOOKAT and then does the same and shows ACTION and then OPTIONS.

Also if the player moves the cursor to the Left it reverves the selection.



Can this be done with scripts and windows? for the main MENU?


Many thanks

21
Technical forum / Re: Actor turn relative to mouse pointer
« on: August 29, 2008, 12:41:30 PM »
Simple................easy for you to say  :D

So this variable is then called within a script.................how?....sorry but I am just getting into all this  :D

Art-wise is no issue, I will create the sprites for the different frames needed, I just need help with the scripting side.

Many thanx Mnemonic !

22
Technical forum / Re: Actor turn relative to mouse pointer
« on: August 29, 2008, 10:26:55 AM »
Thanks for the pointers Spellbreaker, If the actor is doing other animations then I would make the mouse pointer inactive, so the check for the actor to follow the pointer would also check if the mouse pointer was active initially.


Has anyone on the forum done something like this? or got a basic test?

Thanx

23
Technical forum / Actor turn relative to mouse pointer
« on: August 28, 2008, 11:54:25 AM »
Hello,
       I am thinking about using the software and was wondering for a 2D game (not 3D, not that advanced yet hahahaha) can it be scripted that the main actor turns or moves its head relative to the mouse pointer on the screen?

Example: Actor is in foreground, player moves pointer from directly ahead of actor to the right - Actor moves head to the right, player moves pointer up and actor turns UPRIGHT. Player moves pointer above actor, actor moves UP etc

Depending how far away the pointer is from the actor depends wether he turns or just moves his head.

And then if the main actor is in the distance and the player moves the pointer the actor would then animate slightly different.

Is this possible in 2D??


Thanx

Pages: 1 [2]

Page created in 0.024 seconds with 23 queries.