Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Rotation for Dummies?  (Read 4759 times)

0 Members and 1 Guest are viewing this topic.

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Rotation for Dummies?
« on: August 12, 2009, 10:15:05 AM »

Hi all

I read of all these clever people making things rotate, but I just don't get it. According to my warped imagination, the code below should have the sprite in the entity in the node "png" spinning like topsy, but no. The sprite appears, but remains resolutely upright and immobile.
Code: [Select]
var q = Scene.GetNode("png");
var r = q.GetSprite();
r.Rotatable = true;
while(true)
  {
  r.Rotate = 10;
  Sleep(100);
  }

I realise it's probably because I've got the whole concept wrong but after ages on the forum and the docs, trying this and that, I can't figure it out. Can somebody please point out what I've misunderstood?

Galaxy Quest - "explain as you would a child"

Thanks
 
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Rotation for Dummies?
« Reply #1 on: August 12, 2009, 10:29:35 AM »

You only need to change the line to:

r.Rotate = r.Rotate + 10;

to keep increasing the angle.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Rotation for Dummies?
« Reply #2 on: August 12, 2009, 11:41:17 AM »

Nope. Change applied. Entity still as staunchly rigid as ever. No sign of rotation.
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Rotation for Dummies?
« Reply #3 on: August 12, 2009, 11:53:48 AM »

Oh and you want to rotate the entity, not the sprite. So...

q.Rotatable = true;

q.Rotate = q.Rotate + 10;
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

lacosaweb

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 116
    • View Profile
Re: Rotation for Dummies?
« Reply #4 on: August 12, 2009, 12:47:41 PM »

Oh and you want to rotate the entity, not the sprite. So...

q.Rotatable = true;

q.Rotate = q.Rotate + 10;



Maybe you need to give an initial value

q.Rotate=0;

else r.Rotate=NULL the q.Rotate = q.Rotate + 10 will not work.
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Rotation for Dummies?
« Reply #5 on: August 12, 2009, 04:14:52 PM »

Setting q.Rotate = 0; first did it. That's great, thanks.

But should it work in a window, where a container 'EntImage' has an entity I want to rotate? I have a button with its own script that is supposed to start the entity rotating. No rotation is produced. Help please?

Thanks

Code: [Select]
on "LeftClick"
  {
  var x = Game.MouseX;
  var y = Game.MouseY;
  Game.LockMouseRect(x,y,x,y);
  this.SetCursor("scenes\black\RotateCursorP.PNG");
  Game.PlayMusicChannel(0, "scenes\black\StarsAndStripes.ogg", true);
  global w;  // Call the loaded window
  var i;
  i = w.GetControl("EntImage");
  i.Rotate = 0;
  while(true)
    {
    i.Rotate = i.Rotate + 10;
    Sleep(100);
    }
  }
on "LeftRelease"
  {
  this.SetCursor("scenes\black\RotateCursor.PNG");
  Game.StopMusicChannel(0);
  Game.LockMouseRect(0,0,0,0);
  }
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

lacosaweb

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 116
    • View Profile
Re: Rotation for Dummies?
« Reply #6 on: August 12, 2009, 08:04:14 PM »

try with this:

Code: [Select]
on "LeftClick"
  {
  var x = Game.MouseX;
  var y = Game.MouseY;
  Game.LockMouseRect(x,y,x,y);
  this.SetCursor("scenes\black\RotateCursorP.PNG");
  Game.PlayMusicChannel(0, "scenes\black\StarsAndStripes.ogg", true);
  global w;  // Call the loaded window
  var i;
  var e;
  e = w.GetControl("EntImage");
  i=e.GetEntity();
  i.Rotate = 0;
  while(true)
    {
    i.Rotate = i.Rotate + 10;
    Sleep(100);
    }
  }
on "LeftRelease"
  {
  this.SetCursor("scenes\black\RotateCursor.PNG");
  Game.StopMusicChannel(0);
  Game.LockMouseRect(0,0,0,0);
  }

this is the change:

e = w.GetControl("EntImage");
i=e.GetEntity();
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Rotation for Dummies?
« Reply #7 on: August 12, 2009, 10:06:44 PM »

Thanks Lacosweb for your time and effort.

I put your suggestion in.

The result is that nonetheless, the entity remains as fixed and unmoveable as paint. Rotation is what it won't do :)
 
Is there some meaning of the word "Rotate" I haven't grasped? Have I got my entities wrong? Does it simply not work in a window?

BTW, this is a well-worn path - it's a jigsaw puzzle.

Any other thoughts, chaps?

Thanks
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Rotation for Dummies?
« Reply #8 on: August 12, 2009, 10:10:21 PM »

In your original post you had the Rotatable = true line. I don't see it in the new script. Maybe that's the problem? Other than that it should work.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Rotation for Dummies?
« Reply #9 on: August 13, 2009, 02:35:51 PM »

Yup. Missed it.  ::slug

(With deft flick of ankle, plants own boot upon own jacksy)

Thanks for help chaps.

Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com
 

Page created in 0.056 seconds with 24 queries.