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: scaling and rotating entities  (Read 7061 times)

0 Members and 1 Guest are viewing this topic.

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
scaling and rotating entities
« on: September 17, 2004, 10:21:39 PM »

hello back again with some questions.

Project is making progress these days but also some new problems....
i have in my mind a routine for smoke. Now i know to fade  the alphacolour of an entitie. i tried to change the scale and the rotation of
the entitie the same way, but its not working.

is it possible to change the scale and rotation of an entitie ??? i tried  "this.Rotation" and "this.Scale" but its not doing anything

Greets
Stucki


Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re: scaling and rotating entities
« Reply #1 on: September 18, 2004, 12:28:49 AM »

Hey Stucki,

i have in my mind a routine for smoke. Now i know to fade  the alphacolour of an entitie. i tried to change the scale and the rotation of
the entitie the same way, but its not working.
is it possible to change the scale and rotation of an entitie ??? i tried  "this.Rotation" and "this.Scale" but its not doing anything

It is possible. Rotation only works in hardware accelerated mode though. Scale definitely works, maybe you used some wrong parameters or used "this" in a wrong context, hard to say without some more code. (I used it in my old "Weather god" example for different sizes of the snowflakes). The method name for Rotation is "Rotate" though, not Rotation. Something like "myEntity.Rotate(90);" should work fine to rotate your entity by 90 degrees clock-wise.

Here are the commands, you can also find them in the docs in the section "Script language reference" -> "Entity object":

Code: [Select]
Scale            Specifies a scale of this object (overrides scene scaling); set to null to reset default behavior.
ScaleX           Specifies horizontal scale of this object; set to null to reset default behavior.
ScaleY           Specifies vertical scale of this object; set to null to reset default behavior.
RelativeScale    Specifies a scale amount to be added to the default scene scale.
Rotate           Specifies rotation of this object (in degrees); overrides scene rotation; set to null to reset default behavior; not available in compatibility mode
RelativeRotate   Specifies a rotation amount to be added to the default scene rotation.

If it won't work, feel free to post some of the surrounding code. Good luck.  :)
Logged
Mooh!

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: scaling and rotating entities
« Reply #2 on: September 18, 2004, 01:19:37 PM »

okay changed the this.Rotate(90) but still there is no progress ...
here is the code ...




#include "scripts\base.inc"
this.AlphaColor = RGB(255, 255, 255, 0);
Sleep(12000);
this.Rotate(90);
this.Scale(5);

var a = 0;
var i = 0;
for(a = 0; a<=255; a=a+10)
{
   this.AlphaColor = RGB(255, 255, 255, a);
   Sleep(2);
}

fading in is working fine , but its just in the original scale and its not rotated by 90 degrees ....

the goal of this is to fade in an entity while it is scaled from 0 % to 100% and rotated by 90 degrees ....
doing this with more than one entity should create some kind of smoke effect.. ....

greets
stucki

 

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: scaling and rotating entities
« Reply #3 on: September 18, 2004, 01:39:41 PM »

It should be:

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

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re: scaling and rotating entities
« Reply #4 on: September 18, 2004, 02:24:07 PM »

It should be:
this.Rotate = 90;
this.Scale = 5;

Ugh, sure, those are properties, not methods. Sorry :-[
I shouldn't answer deep in the night. :)
« Last Edit: September 18, 2004, 02:25:44 PM by Jerrot »
Logged
Mooh!

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: scaling and rotating entities
« Reply #5 on: September 18, 2004, 02:45:40 PM »

still nothing changes in my scene ......
its fading in, but its not scaled and its not rotated ....

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: scaling and rotating entities
« Reply #6 on: September 18, 2004, 03:37:55 PM »

In that case check if your entity has both .Scalable and .Rotatable attributes set to true.
Also, as Jerrot already mentioned, the rotation only works in accelerated mode.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: scaling and rotating entities
« Reply #7 on: September 18, 2004, 06:01:01 PM »

okay thats it. did not know that the properties had to be set true.
now its working ...
thanks for the quick help !!

stucki

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: scaling and rotating entities
« Reply #8 on: September 19, 2004, 04:18:48 PM »

thank to your help my lamps are now smoking ..... looks fine for me.

One little "problem" -  about the entities´ coordinates in the scene.
Is it possibly to change the insertionpoint. It is set by default to the top-left corner of the entity.
For scaling and rotating it would be very useful if the coordinates belong to the center of the entity. So they do not move to the bottom-right when scaled
also when rotated they move rather "uncontrolled" in the scene.

Greets
Stucki

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: scaling and rotating entities
« Reply #9 on: September 19, 2004, 04:25:26 PM »

You have to use a sprite instead of an ordinary image. It can be a sprite with only one frame; you can then move the hotspot wherever you need in SpriteEdit.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: scaling and rotating entities
« Reply #10 on: September 19, 2004, 04:29:52 PM »

okay, stupid me again ..... thanks
Stucki
 

Page created in 0.035 seconds with 23 queries.