* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 28, 2017, 12:53:29 PM

Login with username, password and session length

Getting projectiles to stay on the ground

  • 10 Replies
  • 430 Views
*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 544
  • Baddest Sonic Fan Alive
Getting projectiles to stay on the ground
« on: May 19, 2017, 06:47:54 AM »
It may be how I set this up, but I had some help with spike traps I'm using like Battletoads, where they blink to the side of the screen before they appear on the ground. What I did was make the blinking entity a panel type so if the screen changes position, it would remain follow to keep it's position, then I made it shoot the actual trap once the blinking animation is done. The problem I'm having is that the shots stay suspended in the air if I jumped and was in the air while the shooting(panel) entity is blinking. I tried Spawning via script (Spawn01) but it didn't help.

Basically, I need a way to keep the spike traps on the ground regardless of the panel entity being in the air.
Code: [Select]
name SPIKES2S
type Panel
shadow 0
alpha   0
remove  0
speed 10
setlayer 1
offscreenkill 5000
subject_to_gravity 1

animationscript data/scripts/script.c

anim FOLLOW1
loop 1
delay 10
offset 40 56
frame data/chars/Traps/spike0.gif
frame data/chars/misc/empty.gif
frame data/chars/Traps/spike0.gif
frame data/chars/misc/empty.gif
frame data/chars/Traps/spike0.gif
frame data/chars/misc/empty.gif
frame data/chars/Traps/spike0.gif
frame data/chars/misc/empty.gif
frame data/chars/Traps/spike0.gif
frame data/chars/misc/empty.gif
delay 1
@cmd spawn01 "SPIKES2" 0 0 0
frame data/chars/misc/empty.gif
@cmd killentity getlocalvar("self")
frame data/chars/misc/empty.gif

Code: [Select]
name SPIKES2
health 1
type obstacle
hostile Player NPC Enemy
candamage Player NPC Enemy
nomove 1
remove 0
setlayer -1
gfxshadow 1
offscreenkill 550
icon data/chars/misc/empty.gif
diesound data/sounds/wood.wav


anim idle
loop 1
delay 2
offset 40 56
attack3  24  31  32  25  15  1  0  0  0  10
        move    6
frame data/chars/Traps/spike0.gif
        move    7
frame data/chars/Traps/spike0.gif
frame data/chars/Traps/spike0.gif

x)
« Last Edit: May 19, 2017, 06:51:37 AM by DJGameFreakTheIguana »

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4656
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Getting projectiles to stay on the ground
« Reply #1 on: May 19, 2017, 11:44:24 AM »
Just set the y position of the new spawn spike to zero.

*

Offline esn23

  • Hero Member
  • *****
  • 755
    • Atlas
Re: Getting projectiles to stay on the ground
« Reply #2 on: May 19, 2017, 06:23:10 PM »
Yea if you spawn it on screen in front of the person then it will just appear out of thin air.. If you spawn at 0 and then spawn it a bit off screen it will spawn while you are not on the screen so it just doesn't appear suddenly. 
WIPS







*

Offline Bloodbane

  • Hero Member
  • *****
  • 3055
  • Dark Dragon
Re: Getting projectiles to stay on the ground
« Reply #3 on: May 19, 2017, 07:25:28 PM »
Just set the y position of the new spawn spike to zero.

 Yes, you do that like this:

Code: [Select]
anim idle
loop 1
delay 2
offset 40 56
attack3  24  31  32  25  15  1  0  0  0  10
        move    6
frame data/chars/Traps/spike0.gif
        move    7
frame data/chars/Traps/spike0.gif
frame data/chars/Traps/spike0.gif

anim spawn
@script
    if(frame==1){
      void self = getlocalvar("self");

      changeentityproperty(self, "position", NULL(), NULL(), 0);
    }
@end_script
delay 2
offset 40 56
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif

 I declared SPAWN animation after IDLE to prevent OpenBoR from taking palette from empty.gif

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4656
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Getting projectiles to stay on the ground
« Reply #4 on: May 19, 2017, 10:16:40 PM »
Quote
I declared SPAWN animation after IDLE to prevent OpenBoR from taking palette from empty.gif
Care to explain this?

*

Offline DJGameFreakTheIguana

  • Hero Member
  • *****
  • 544
  • Baddest Sonic Fan Alive
Re: Getting projectiles to stay on the ground
« Reply #5 on: May 21, 2017, 03:05:39 PM »
Thanks for the script Bloodbane, but sometime later while at work, I had finally got the idea to sync the animation of the damaging spikes with the blinking ones and spawn them at the same time, so when the blinking spikes die via script, the damaging ones move out into the screen from outside the boundary. I thought I ran out of ideas after I had posted this but maybe one day I can make us of the position script.

x)

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3055
  • Dark Dragon
Re: Getting projectiles to stay on the ground
« Reply #6 on: May 22, 2017, 12:23:08 AM »
Quote
I declared SPAWN animation after IDLE to prevent OpenBoR from taking palette from empty.gif
Care to explain this?

 If palette command isn't declared, OpenBoR will take palette from the very first declared image
 Example:
Code: [Select]
name Slab
health  20
type obstacle
defense all 0 200
setlayer 11
nolife 1
antigrab 100 # platform's length
grabforce 40 # platform's height
offscreenkill 4000
animationscript data/scripts/lescript.c


anim spawn
@script
    if(frame == 1){
      void self = getlocalvar("self");
      int Aggro = getentityproperty(self,"aggression");

      if(Aggro==2){
        performattack(self, openborconstant("ANI_FOLLOW2"));
      } else if(Aggro==3){
        performattack(self, openborconstant("ANI_FOLLOW3"));
      } else {
        performattack(self, openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
    delay 5
offset 50 40
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif

anim idle
loop 1
    delay 10
offset 50 40
bbox 0 0 100 40
platform 50 40 -65 -65 65 65 21 40
frame data/chars/misc/boxes/slabM.png
frame data/chars/misc/boxes/slabM.png
...

 With this setting, OpenBoR will take palette from empty.gif as Slab2's palette
 But in this example:
Code: [Select]
name Slab
health  20
type obstacle
defense all 0 200
setlayer 11
nolife 1
antigrab 100 # platform's length
grabforce 40 # platform's height
offscreenkill 4000
animationscript data/scripts/lescript.c


anim idle
loop 1
    delay 10
offset 50 40
bbox 0 0 100 40
platform 50 40 -65 -65 65 65 21 40
frame data/chars/misc/boxes/slabM.png
frame data/chars/misc/boxes/slabM.png

anim spawn
@script
    if(frame == 1){
      void self = getlocalvar("self");
      int Aggro = getentityproperty(self,"aggression");

      if(Aggro==2){
        performattack(self, openborconstant("ANI_FOLLOW2"));
      } else if(Aggro==3){
        performattack(self, openborconstant("ANI_FOLLOW3"));
      } else {
        performattack(self, openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
    delay 5
offset 50 40
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
...

 Slab2's palette will be taken from slabM.png

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4656
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Getting projectiles to stay on the ground
« Reply #7 on: May 22, 2017, 09:07:40 PM »
ah yes, this is way I use palette none :)

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1696
    • DC Current
Re: Getting projectiles to stay on the ground
« Reply #8 on: May 23, 2017, 06:07:28 AM »
ah yes, this is way I use palette none :)

That means every frame has it's own palette. Total waste unless you're working with something like a digitized set of photos that never got properly homogenized. Sure you are using that attribute correctly?
Projects in progress are now available here: https://github.com/DCurrent

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4656
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Getting projectiles to stay on the ground
« Reply #9 on: May 24, 2017, 09:54:53 PM »
Really? but I thought you said "Per entity, for every entity using palette none." So its per frame?
And this is one of the cases where I can't understand WHY this info wasn't never included on the manual, since its so important.

Thanks, I will fix my stuff.

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1696
    • DC Current
Re: Getting projectiles to stay on the ground
« Reply #10 on: May 24, 2017, 11:31:46 PM »
Really? but I thought you said "Per entity, for every entity using palette none." So its per frame?
And this is one of the cases where I can't understand WHY this info wasn't never included on the manual, since its so important.

Thanks, I will fix my stuff.

Think we just have miscommunication - talking about different things. No big. We'll talk more about it on Facebook.  :)
Projects in progress are now available here: https://github.com/DCurrent

 

Recent

Members
  • Total Members: 6226
  • Latest: esc
Stats
  • Total Posts: 45171
  • Total Topics: 3096
  • Online Today: 39
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 3
Guests: 29
Total: 32