playMaker

Author Topic: RagePixel  (Read 9439 times)

elvis75k

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 97
    • nRender
RagePixel
« on: March 05, 2012, 03:36:36 PM »
Hello playMakers! I've managed to build a simple scene following the walker tutorial on ragepixel.com
It's all fun to play with and i always wanted to make something simple in the spare time using pixel art..
@jeanfabre It is possible to convert the Sprite Manager 2 custom actions into this?
Here is the waker script that make me want all this right now... http://ragepixel.com/tutorial1/

Cheers
« Last Edit: March 05, 2012, 03:48:11 PM by elvis75k »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: RagePixel
« Reply #1 on: March 06, 2012, 06:25:08 AM »
Hi,

 Sounds good to me :) It is of course totally possible to provide playmaker actions to work with ragePixel, no problem.

 Now -- Reality cold shower: I am really busy currently, and I have pending support to provide on a number of thread in playmaker forum, and got behind my promises on helping. That will have to have priority during my spare time currently.

 If however you want this to be done now because you have to deliver and progress on a project, pm me and we'll arrange something. Else, please come back to me in a week to remind me of these actions and I'll see what I can do if nothing came up before from other members.

 Bye,

 Jean

elvis75k

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 97
    • nRender
Re: RagePixel
« Reply #2 on: March 06, 2012, 09:52:28 AM »
Thanks Jean. All i need for now is just the play, pause, stop, flip animation to play with ;)
I've managed to change the PlayAnimation script to work with ragePixel: at last PlayMaker is telling me that the owner is indeed a ragePixel object: i did this just for fun all night long, and i can't go that far with my little code# knowledge. Here's it just to make you smile.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using System;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Plays an Animation on a Game Object. You can add named animation clips to the object in the Unity editor, or with the Add Animation Clip action.")]
public class PlayRageAnimation : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("Game Object to play the animation on.")]
public FsmOwnerDefault gameObject;

//[RequiredField]
//[CheckForComponent(typeof(Animation))]
[Tooltip("Rage Game Object to play the animation on.")]
public RagePixelSprite rageGameObject;

[UIHint(UIHint.Animation)]
[Tooltip("The name of the animation to play.")]
public FsmString animName;

[Tooltip("How to treat previously playing animations.")]
public PlayMode playMode;

[HasFloatSlider(0f, 5f)]
[Tooltip("Time taken to blend to this animation.")]
public FsmFloat blendTime;

[Tooltip("Event to send when the animation is finished playing. NOTE: Not sent with Loop or PingPong wrap modes!")]
public FsmEvent finishEvent;

[Tooltip("Event to send when the animation loops. If you want to send this event to another FSM use Set Event Target. NOTE: This event is only sent with Loop and PingPong wrap modes.")]
public FsmEvent loopEvent;

[Tooltip("Stop playing the animation when this state is exited.")]
public bool stopOnExit;

private AnimationState anim;
private float prevAnimtTime;

public override void Reset()
{
gameObject = null;
animName = null;
playMode = PlayMode.StopAll;
blendTime = 0.3f;
finishEvent = null;
loopEvent = null;
stopOnExit = false;
}

public override void OnEnter()
{
DoPlayAnimation();
}

void DoPlayAnimation()
{
string logString;
if (rageGameObject is RagePixelSprite){
logString = "yes";
}else{
logString = "no";
}

Debug.Log(logString);

var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null || string.IsNullOrEmpty(animName.Value))
{
Finish();
return;
}

if (string.IsNullOrEmpty(animName.Value))
{
LogWarning("Missing animName!");
Finish();
return;
}

if (go.animation == null)
{
LogWarning("Missing animation component!");
Finish();
return;
}

anim = go.animation[animName.Value];

if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
Finish();
return;
}

var time = blendTime.Value;
if (time < 0.001f)
{
go.animation.Play(animName.Value, playMode);
}
else
{
go.animation.CrossFade(animName.Value, time, playMode);
}

prevAnimtTime = anim.time;
}

public override void OnUpdate()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null || anim == null)
{
return;
}

if (!anim.enabled || (anim.wrapMode == WrapMode.ClampForever && anim.time > anim.length))
{
Fsm.Event(finishEvent);
Finish();
}

if (anim.wrapMode != WrapMode.ClampForever && anim.time > anim.length && prevAnimtTime < anim.length)
{
Fsm.Event(loopEvent);
}
}

public override void OnExit()
{
if (stopOnExit)
{
StopAnimation();
}
}

void StopAnimation()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go != null && go.animation != null)
{
go.animation.Stop(animName.Value);
}
}
}
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: RagePixel
« Reply #3 on: March 06, 2012, 02:14:01 PM »
Hi,

 Best way to learn is to do it! so keep trying, from what I saw it's ok, keep posting on your progress or where you get stuck ok?!

 Bye,

 Jean

slipside

  • Playmaker Newbie
  • *
  • Posts: 4
Re: RagePixel
« Reply #4 on: March 09, 2012, 02:48:10 AM »
I would also be interested in RagePixel actions :)

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: RagePixel
« Reply #5 on: March 09, 2012, 09:09:22 AM »
Me too! :)


I would also be interested in RagePixel actions :)

MIKMANNER

  • Playmaker Newbie
  • *
  • Posts: 10
Re: RagePixel
« Reply #6 on: March 12, 2012, 07:55:08 AM »
A set of RagePixel actions would be amazing, I've been using it for a few days now and it could be an excellent way of knocking out quick assets, I've been copy / pasting code to trigger animations but playmaker actions would make it a lot easier.

elvis75k

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 97
    • nRender
Re: RagePixel
« Reply #7 on: April 06, 2012, 07:06:32 PM »
just discovered that most commands that i was planning to customize for playmaker are already here.
You can play animations,  flip sprites.. all you need is in Send Message! For animation just put the name in the string field, for flip vertical/horizontal use the boolean. Hope this helps.
bye

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: RagePixel
« Reply #8 on: April 09, 2012, 05:24:14 AM »
hi,

 Yes, and you can also invoke functions, and even access properties of classes using the FsmObject variable and set/get properties actions.

Bye,

 Jean

ManzanitaPR

  • Playmaker Newbie
  • *
  • Posts: 5
Re: RagePixel
« Reply #9 on: June 22, 2012, 11:09:22 PM »
I don't quite understand... how did you get the actions to work with play maker? I know its an old thread, but i'm kinda stuck

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: RagePixel
« Reply #10 on: June 23, 2012, 08:56:23 AM »
Bumparoonie.

Please can i have some help on this matter, been trying to figure it out all week :(

Will that action do the trick for animations or does it only half work?
« Last Edit: June 23, 2012, 09:04:54 AM by shinodan »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: RagePixel
« Reply #11 on: June 23, 2012, 03:57:45 PM »
Hi,

 Ok, I will work on rage pixels custom actions for playmaker. I should have something ready for mid next week.

 bye,

 Jean

ManzanitaPR

  • Playmaker Newbie
  • *
  • Posts: 5
Re: RagePixel
« Reply #12 on: June 25, 2012, 12:27:50 AM »
Awesome, thanks man!  How will we know when it's ready? This is exactly what I needed to continue workin on my current project :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: RagePixel
« Reply #13 on: June 25, 2012, 01:16:52 AM »
Hi,

 I will open a thread and it will be available on the wiki. I'll also reply to this thread, so stay tuned.

bye,

 Jean