Topic: New features by lunarrush

This thread will be for me to post any new features I add to the engine, the first post will continuously change as I add more stuff so that it can make it's way into the release.

Added features:

  • on_player_invincible

  • enable_player_roll

  • disable_player_roll

Features I'm currently working on:

  • give_player_shield

  • setting player physics modifiers via scripting

Cancelled features:

  • unroll_player

Link to file containing full file diff+updated exe: https://dl.dropbox.com/u/22535351/diff%28lunar%29.zip
Link to file containing just diff vs. release: TO COME
Note: the above link will never change, the contents of the link will.

Last edited by lunarrush (2012-06-20 23:17:24)

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: New features by lunarrush

Double posted so that flow of first post will not be interrupted, the first post should not be interfered with for something like this:
I tried writing an unroll script, and met with some relative success, however holding down while moving still allowed for rolling.  I am now trying a new approach of enable_player_roll/disable_player_roll.  It will probably require a state change right after it though because it simply adds 10000 to the current roll threshold of the player.  In other words, calling it twice in a row could be a problem.  If you have a better solution than this please add it here before I continue coding this any further.
thanks,
-lunar

Edit: Just tried to put in an enable_player_roll/disable_player_roll function but it failed spectacularly, I think I may have to rewrite the player struct to make it work.  I have reverted my code to a usable thing and now I am going to bed.  Hopefully I'll have better luck in the morning.

Last edited by lunarrush (2012-06-20 09:13:42)

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: New features by lunarrush

have you tried setting the PA state to "stopped" and gsp to 0?

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: New features by lunarrush

Could you make a decorator called "lock_player_animation"?

And "give_shield"?

Last edited by S32X (2012-06-20 19:30:07)

Re: New features by lunarrush

@S32X: What would the lock_player_animation decorator do?  Give shield should not be too difficult, however I'm probably going to finish messing with roll first.

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: New features by lunarrush

Well, look at this video

http://www.youtube.com/watch?v=obM6xEBA … e=youtu.be

If you've read the description, you'll see what I mean. Basically "lock_player_animation" would lock the requested animation.

P.S. If you've seen the trailer, Apoc City zone has a new brickset and no longer includes Ashura.

P.P.S New decorator ideas "unlock_player_animation", "keep_current_shield" and "keep_collectibles"

Last edited by S32X (2012-06-20 20:45:19)

Re: New features by lunarrush

There is a reason it does that, you cannot count on set_player_animation unless you call disable_player_movement first.

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: New features by lunarrush

Okay I'll look into that.

Last edited by S32X (2012-06-20 20:52:40)

Re: New features by lunarrush

here's a workaround, not an easy one, though.

create an object that is the master of all player animations. when you need to set an animation, you can use change_closest_object_state "animation_master" "desired_animation". doing this usually forces any given animation.

if you need to unset them it is the same, just change to a blank state.

Last edited by KZR (2012-06-20 20:50:59)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: New features by lunarrush

Kinda confused about that. Could you give me a script?

11

Re: New features by lunarrush

Master object example. ".animation_master"

state "roll_animation"
{
set_player_animation X
}
state "release_animation"
{
}

Any other object that needs to roll the player

state "roll_player"
{
change_closest_object_state ".animation_master" "roll"
on_timeout 3 "unroll"
}

state "unroll"
{
change_closest_object_state ".animation_master" "release"
....
}

instead of changing the animation directly in other scripts, you put the animation controls into an object. whenever you want the player to be forced an animation, instead of set_player_animation you use change_closest_object_state to change that "master" to the state where it forces the animation you want. once you're done, change to release state. never destroy the master.

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: New features by lunarrush

K thanks.

Re: New features by lunarrush

Added:
enable_player_roll and disable_player_roll.  Will be documenting this and everything else I have added so far in the api reference.  Link is available in first post

Last edited by lunarrush (2012-06-20 23:17:54)

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: New features by lunarrush

If you put "roll_player" will it crash?

Re: New features by lunarrush

It sets the roll threshold extremely high, you can try it if you wish but I do not think it will impact roll player.  It only prevents rolling via non-scripted method.

If I knew then what I know now I'd tell you that the story's true.  Cause whatever you do, it comes back to you.  -Slaughter, Burning Bridges

Re: New features by lunarrush

another decorator idea. "magnet_movement". It basically makes the object move toward the player, but only left and right.

Example:

  object "Stalker Robot"
 {
      state "main"
   {
          set_animation "SD_STALKER" 0
          walk 100.0
          enemy 100
          on_player_observed "Sonic" "magnet"
   }
     state "magnet"
   {
         magnet_movement 100
         change_state "main"
   }
}

@KZR

Does the release state have to have something, or can it be blank?

Last edited by S32X (2012-06-21 03:29:36)

Re: New features by lunarrush

^ can be achieved with formulas already.

move "sign(xpos() - player_xpos()) * 100" 0

is the exact same thing as

magnet_movement 100

Re: New features by lunarrush

Oh. I'm not good with radians.

19

Re: New features by lunarrush

it can be blank if nothing else forces animations.


even simpler magnet

look_at_player
move_player -direction()*100

Last edited by KZR (2012-06-21 04:19:59)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: New features by lunarrush

KZR wrote:

even simpler magnet

look_at_player
move_player -direction()*100

The object moves toward the player.

@SupertheHedgie

You're script makes the object move away from the player. I fixed it.

Last edited by S32X (2012-06-21 05:05:25)

Re: New features by lunarrush

I double posted because I'd clutter-up the post above. hmm

@lunnarush

Could you add a "shake_camera" decorator?

EDIT: Could you also add a "stop_sample" one too?

Last edited by S32X (2012-06-21 06:46:14)

22

Re: New features by lunarrush

if the object moves to the player you're doing it wrong.
it's

move_player -direction()... 

not

move -player_direction()...

the second option would cause what you mentioned, not he first.

shake_camera is not needed. you can do that with the camera commands. and stop_sample already exists

Last edited by KZR (2012-06-21 21:37:32)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: New features by lunarrush

I'll just go with Super's.

Re: New features by lunarrush

I think it's awesome, but I urge you to please follow the conventions in the code. This is utterly important. I can't emphasize enough. It's not just a cosmetic thing: it's a life-or-death issue. The task is not to simply "add features". The task is to add features while maintaining quality code (and therefore quality software), and doing this requires lots of discipline.

For example, in the player module, the entire interface is composed by functions named player_something(...). Other interfaces through the engine follow a similar convention: actor_something(...), input_something(...), etc. If you add a "enable_player_roll_p" to the player module, you break the convention. Also, that function must be declared in the interface (the .h) - it seems it isn't there.

Please follow the conventions. Also, if you have any questions, please feel free to ask. I truly admire the efforts and I'm lovin' it smile, but please let's keep the quality code, shall we?

Keep up the good work. cool

Re: New features by lunarrush

Hey Alex. How did you shake the camera in cutscene 1 of Open Surge?

Last edited by S32X (2012-06-22 02:47:22)