create a platform

Simple, make an entity with platform set then move it left and right ;)

This example for 2D platform:

name Platbot1
type none
setlayer 2
facing 1
aggression 1
antigravity 100
subject_to_wall  0
subject_to_obstacle 0
subject_to_platform 0


anim idle
@script
    void self = getlocalvar("self");

    if(frame==1){
      changeentityproperty(self, "velocity", 0.5);
    } else if(frame==2){
      changeentityproperty(self, "velocity", -0.5);
    }
@end_script
    loop 1
    delay 80
    offset 31 34
    platform 31 34 -32 -32 32 32 7 7
    frame data/chars/misc/platform/platbot1.png
    frame data/chars/misc/platform/platbot1.png

BTW do you want 2D platform or 3D one?
 
Yes, you need to change the script a bit so it moves in y axis like this:

Code:
@script
    void self = getlocalvar("self");

    if(frame==1){
      changeentityproperty(self, "velocity", 0, 0, 0.5);
    } else if(frame==2){
      changeentityproperty(self, "velocity", 0, 0, -0.5);
    }
@end_script

The platform will move up then down and repeat with this script

Oh yes to control how long platform moves in one direction before changing direction, modify the delay value
 
only going in one direction and does not return
Code:
name      plat_derecha
setlayer   2
facing      1
aggression   1
antigravity   100
subject_to_wall  0
subject_to_obstacle 0
subject_to_platform 0

anim idle
@script
    void self = getlocalvar("self");

    if(frame==1){
      changeentityproperty(self, "velocity", 0.5);
    } else if(frame==2){
      changeentityproperty(self, "velocity", -0.5);
    }
@end_script
  
    loop   1
    delay   16
    offset	32 17
    platform  17  18  -16  -16  45  45  2  16
    frame	data/chars/misc/plataformas/plat.png
    frame	data/chars/misc/plataformas/plat.png

there is something wrong?
 
yes, there is no third frame.
Try this

Code:
anim idle
@script
    void self = getlocalvar("self");

    if(frame==0){
      changeentityproperty(self, "velocity", 0.5);
    } else if(frame==1){
      changeentityproperty(self, "velocity", -0.5);
    }
@end_script
    loop   1
    delay   80
    offset   31 34
    platform   31 34 -32 -32 32 32 7 7
    frame   data/chars/misc/platform/platbot1.png
    frame   data/chars/misc/platform/platbot1.png
 
Code:
anim idle
@script
    void self = getlocalvar("self");

    if(frame==0){
      changeentityproperty(self, "velocity", 0.5);
    }     if(frame==1){
      changeentityproperty(self, "velocity", 0);
    }     if(frame==2){
      changeentityproperty(self, "velocity", -0.5);
    } else if(frame==3){
      changeentityproperty(self, "velocity", 0);
    }

@end_script
    loop   1
    delay   80
    offset   31 34
    platform   31 34 -32 -32 32 32 7 7
    frame   data/chars/misc/platform/platbot1.png
    delay   40
    frame   data/chars/misc/platform/platbot1.png
    delay   80
    frame   data/chars/misc/platform/platbot1.png
    delay   40
    frame   data/chars/misc/platform/platbot1.png


Or
Code:
anim idle
    loop   1
    delay   80
    offset   31 34
    platform   31 34 -32 -32 32 32 7 7
@cmd changeentityproperty getlocalvar("self") "velocity" 0.5
    frame   data/chars/misc/platform/platbot1.png
    delay   40
@cmd changeentityproperty getlocalvar("self") "velocity" 0
    frame   data/chars/misc/platform/platbot1.png
    delay   80
@cmd changeentityproperty getlocalvar("self") "velocity" -0.5
    frame   data/chars/misc/platform/platbot1.png
    delay   40
@cmd changeentityproperty getlocalvar("self") "velocity" 0
    frame   data/chars/misc/platform/platbot1.png
 
Oops, I forgot about the missing third frame. The original entity I copied this from has 3 frames but I forgot to adjust the script after reducing the frames  :-[
 
Ah so you want 3D platform. Well, the script is the same nonetheless :)
Here's the fixed one:

name      Platbot1
type      none
setlayer  2
facing      1
aggression  1
antigravity  100
subject_to_wall  0
subject_to_obstacle 0
subject_to_platform 0


anim idle
@script
    void self = getlocalvar("self");

    if(frame==0){
      changeentityproperty(self, "velocity", 0.5);
    } else if(frame==1){
      changeentityproperty(self, "velocity", -0.5);
    }
@end_script
    loop  1
    delay  80
    offset  31 34
    platform  31 34 -32 -32 32 32 7 7
    frame  data/chars/misc/platform/platbot1.png
    frame  data/chars/misc/platform/platbot1.png

This platform will go and back permanently

Offtopic: I think it would be better if ninjas drops down from above when they appear to give different impression. Bosses at end of video OTOH should use teleport in animation when they appear :)
Good work on Double Dragon mod!
 
Back
Top Bottom