Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - champy

Pages: 1 2 3
1
Resolved Questions / Re: Can I ignor Sandbox Violation ?
« on: January 13, 2015, 01:00:43 am »
Hi SadiQ
The Error Sandbox violation disappear
Thanks a lot

2
Resolved Questions / Re: Can I ignor Sandbox Violation ?
« on: January 12, 2015, 11:23:51 pm »
It is a security error so presumably you need to change your adobe flash player settings to allow this to happen.
Hi letmethink
How to  change your adobe flash player security settings in Stencyl ?

3
Resolved Questions / Can I ignor Sandbox Violation ?
« on: January 11, 2015, 05:52:48 pm »
Hi
         I have Application program and need to use socket API to connect Flash game for insert value. But when I run test game the An action script error has occurred (with picture). Could you suggest me to solve it.
Thanks you.

4
Ask a Question / Re: How Stencyl use socket api ?
« on: September 25, 2014, 11:46:12 pm »
Can you link to the API?
Hi master rob1221
          Yes I can get link to http://static.stencyl.com/api/31/  but I can't find  Socket API . So I will try  flash.net    and use flash.net.URLLoader   for retrieve data from URL.

5
Ask a Question / How Stencyl use socket api ?
« on: September 24, 2014, 05:35:27 am »
Hello bro
          I'm develop  flash game and I use  MMA8452 accelerometer and install it on arduino. The sensor was already  sent dynamic data in 0.5 second . after that I was used method   nme.Assets.getText("assets/data/data2.txt")  but the data  isn't refresh may be nme.Assets.getText() is a static variable. So  now I want to ask  stencyl expert  "How to use socket api in stencyl ?  can or can't ? "  in code mode. ??? ??? ???

6
I need some help  :'(

7
Hello
   I need  recommend,I used  nme.Assets.getText() for retrieve data from txt file that changes every 0.5 seconds, but the data is still same value . So I used time condition to command the method work in every 0.5 seconds but data is still same
Code: [Select]
     var mili =  haxe.Timer.stamp();        
     var milisec = Std.string(mili);    
     var milisecsplit = milisec.split(".");
     var milisecsub = milisecsplit[1];
     var miliseccal = Std.string(milisecsub);
     var milisecuse = miliseccal.substring(0,2);      
     var modcal = Std.parseInt(milisecuse);

                    if(modcal%50==0){
                    var pitchydata:String = nme.Assets.getText("assets/data/data2.txt"); 

                trace(pitchydata);
                trace(haxe.Timer.stamp());  //timer count secounds 
                trace(miliseccal);                                       
                    }else {
                    trace("not refresh");                   
                    }

.I was rechecked txt file the data have been changes every 0.5 seconds. My friend  recommend  me the method getText() is static method it's cannot get new data from txt file after  compile.  So please advise me to used dynamic method to get data from text or something file in code mode.
 :'( :'( :'(

8
Ask a Question / Re: How to use realtime value in codemode?
« on: August 08, 2014, 12:36:23 am »
Yeah sure:

When Created:

Do Every X seconds

print [value attribute]

Although it looks like it's your value attribute that is not being updated, take a look at that part of your code again. What is the attribute tracking? you need to set an initial value on creation and then set it to it's new value every frame
theabbott

I tried timer event but the values from sensor not change when game working ,I didn't missing anything ?
Code: [Select]
package scripts;
import com.stencyl.graphics.G;
import com.stencyl.behavior.Script;
import com.stencyl.behavior.ActorScript;
import com.stencyl.behavior.SceneScript;
import com.stencyl.behavior.TimedTask;
import com.stencyl.models.Actor;
import com.stencyl.models.GameModel;
import com.stencyl.models.actor.Animation;
import com.stencyl.models.actor.ActorType;
import com.stencyl.models.actor.Collision;
import com.stencyl.models.actor.Group;
import com.stencyl.models.Scene;
import com.stencyl.models.Sound;
import com.stencyl.models.Region;
import com.stencyl.models.Font;
import com.stencyl.Engine;
import com.stencyl.Input;
import com.stencyl.utils.Utils;
import nme.ui.Mouse;
import nme.display.Graphics;
import nme.display.BlendMode;
import nme.events.Event;
import nme.events.TouchEvent;
import nme.net.URLLoader;
import motion.Actuate;
import motion.easing.Back;
import motion.easing.Cubic;
import motion.easing.Elastic;
import motion.easing.Expo;
import motion.easing.Linear;
import motion.easing.Quad;
import motion.easing.Quart;
import motion.easing.Quint;
import motion.easing.Sine;
import box2D.dynamics.joints.B2DistanceJoint;
import Date;
import haxe.Timer;





class Design_27_27_slingshot extends ActorScript
{
    public var _FrontSlingOriginX:Float;
    public var _FrontSlingOriginY:Float;
    public var _FrontSlingThickness:Float;
    public var _BackSlingOriginX:Float;
    public var _BackSlingOriginY:Float;
    public var _BackSlingThickness:Float;
    public var _gotaboulder:Bool;
    public var _boulderthatsattached:Actor;
    public var _SlingMiddleX:Float;
    public var _SlingMiddleY:Float;
    public var _FiringDirection:Float;
    public var _BoulderRadius:Float;
    public var _FiresinonlyoneDirection:Bool;
    public var _expectationsmet:Bool;
    public var _FiringDirectionModifier:Bool;
    public var _SlingX:Float;
    public var _MaximumWidth:Float;
    public var _MaximumPower:Float;
    public var _SlingY:Float;
    public var _TieinwithCatapultKit:Bool;
    public var _FiringDelay:Float;
    public var _FlingNoise:Sound;
    public var _CanShootNoCatapultKit:Bool;
    public var _accely:Float;

    public function _customEvent_NoCatapultTrue():Void
    {
        _CanShootNoCatapultKit = true;
        propertyChanged("_CanShootNoCatapultKit", _CanShootNoCatapultKit);
    }
    public function new(dummy:Int, actor:Actor, engine:Engine)
    {
        super(actor, engine);
        nameMap.set("Front Sling Origin X", "_FrontSlingOriginX");
        _FrontSlingOriginX = 112.0;
        nameMap.set("Front Sling Origin Y", "_FrontSlingOriginY");
        _FrontSlingOriginY = 33.0;
        nameMap.set("Front Sling Thickness", "_FrontSlingThickness");
        _FrontSlingThickness = 8.0;
        nameMap.set("Back Sling Origin X", "_BackSlingOriginX");
        _BackSlingOriginX = 64.0;
        nameMap.set("Back Sling Origin Y", "_BackSlingOriginY");
        _BackSlingOriginY = 30.0;
        nameMap.set("Back Sling Thickness", "_BackSlingThickness");
        _BackSlingThickness = 7.0;
        nameMap.set("got a boulder", "_gotaboulder");
        _gotaboulder = false;
        nameMap.set("the boulder that's attached", "_boulderthatsattached");
        nameMap.set("Sling Middle X", "_SlingMiddleX");
        _SlingMiddleX = 0.0;
        nameMap.set("Sling Middle Y", "_SlingMiddleY");
        _SlingMiddleY = 0.0;
        nameMap.set("Firing Direction", "_FiringDirection");
        _FiringDirection = 0.0;
        nameMap.set("Boulder Radius", "_BoulderRadius");
        _BoulderRadius = 0.0;
        nameMap.set("Fires in only one Direction", "_FiresinonlyoneDirection");
        _FiresinonlyoneDirection = true;
        nameMap.set("Actor", "actor");
        nameMap.set("expectations met", "_expectationsmet");
        _expectationsmet = false;
        nameMap.set("Firing Direction Modifier", "_FiringDirectionModifier");
        _FiringDirectionModifier = true;
        nameMap.set("SlingX", "_SlingX");
        _SlingX = 0.0;
        nameMap.set("Maximum Width", "_MaximumWidth");
        _MaximumWidth = 100.0;
        nameMap.set("Maximum Power", "_MaximumPower");
        _MaximumPower = 100.0;
        nameMap.set("SlingY", "_SlingY");
        _SlingY = 0.0;
        nameMap.set("Tie in with Catapult Kit", "_TieinwithCatapultKit");
        _TieinwithCatapultKit = true;
        nameMap.set("Firing Delay", "_FiringDelay");
        _FiringDelay = 5.0;
        nameMap.set("Fling Noise", "_FlingNoise");
        _FlingNoise = getSound(39);
        nameMap.set("Can Shoot (No Catapult Kit)", "_CanShootNoCatapultKit");
        _CanShootNoCatapultKit = true;
    }
    override public function init()
    {
        _SlingMiddleX = asNumber(((_BackSlingOriginX + _FrontSlingOriginX) / 2));
        propertyChanged("_SlingMiddleX", _SlingMiddleX);
        _SlingMiddleY = asNumber(((_BackSlingOriginY + _FrontSlingOriginY) / 2));
        propertyChanged("_SlingMiddleY", _SlingMiddleY);
        addWhenUpdatedListener(null, function(elapsedTime:Float, list:Array<Dynamic>):Void
        {

            if (wrapper.enabled)
            {           
              var timer = new haxe.Timer(500); // 5000ms delay
               timer.run = function() {
                var pitchydata:String = nme.Assets.getText("assets/data/data2.txt");
                trace(pitchydata);
                timer.stop();
                }
                if (isMouseDown())
                {               
                    if (_gotaboulder)
                    {
                       //trace(_gotaboulder);
                      //  _FiringDirection = asNumber((Utils.DEG * (Math.atan2(((actor.getScreenY() + _SlingMiddleY) - getMouseY()), ((actor.getScreenX() + _SlingMiddleX) - getMouseX()))) + 90));
                        _FiringDirection = 45;
                     //   propertyChanged("_FiringDirection", _FiringDirection);
                     //   trace(_FiringDirection);

                    }

                    if ((Math.sqrt((Math.pow((getMouseX() - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((getMouseY() - (actor.getScreenY() + _SlingMiddleY)), 2))) > _MaximumWidth))
                    {
                        _SlingX = asNumber(((actor.getScreenX() + _SlingMiddleX) + (Math.cos(Utils.RAD * ((_FiringDirection + 90))) * _MaximumWidth)));
                        propertyChanged("_SlingX", _SlingX);
                        _SlingY = asNumber(((actor.getScreenY() + _SlingMiddleY) + (Math.sin(Utils.RAD * ((_FiringDirection + 90))) * _MaximumWidth)));
                        propertyChanged("_SlingY", _SlingY);
                        trace("Math.sqrt"+Math.sqrt((Math.pow((getMouseX() - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((getMouseY() - (actor.getScreenY() + _SlingMiddleY)), 2))));
                        trace("_MaximumWidth"+_MaximumWidth);
                        trace("_SlingX"+_SlingX);
                        trace("_SlingY"+_SlingY);

                                            }
                    else
                    {
                        _SlingX = asNumber(getMouseX());
                        propertyChanged("_SlingX",_SlingX);
                        _SlingY = asNumber(getMouseY());
                        propertyChanged("_SlingY",_SlingY);
                    }
                }
                 
                }
                _expectationsmet = true;
                propertyChanged("_expectationsmet", _expectationsmet);

                if ((asNumber(getGameAttribute("Projectiles Left")) <= 0))
                {
                    _expectationsmet = false;
                    propertyChanged("_expectationsmet", _expectationsmet);
                }

                if (_FiresinonlyoneDirection)
                {
                    if (isMouseDown())
                    {
 
                        if ((_FiringDirectionModifier && (getMouseX() > (actor.getScreenX() + _SlingMiddleX))))
                        {
                            _expectationsmet = false;
                            propertyChanged("_expectationsmet", _expectationsmet);
                        }
                        else if ((!(_FiringDirectionModifier) && ((actor.getScreenX() + _SlingMiddleX) > getMouseX())))
                        {
                            _expectationsmet = false;
                            propertyChanged("_expectationsmet", _expectationsmet);
                        }
                    }
                }

                if (_TieinwithCatapultKit)
                {
                    if ((asBoolean(getValueForScene("Catapult Game Controller", "_InitEndofGame")) || !(asBoolean(getValueForScene("Catapult Game Controller", "_CanShoot")))))
                    {
                        _expectationsmet = false;
                        propertyChanged("_expectationsmet", _expectationsmet);
                    }
                }
                else
                {
                    if (!(_CanShootNoCatapultKit))
                    {
                        _expectationsmet = false;
                        propertyChanged("_expectationsmet", _expectationsmet);
                    }
                }

                if (((isMouseDown() && _expectationsmet) && !(_gotaboulder)))
                {
                    _gotaboulder = true;
                    propertyChanged("_gotaboulder", _gotaboulder);
                    createRecycledActor(getActorType(0), 0, 0, Script.FRONT);
                    _boulderthatsattached = getLastCreatedActor();
                    propertyChanged("_boulderthatsattached", _boulderthatsattached);
                    getLastCreatedActor().setValue("Projectile", "_attachedtocatapult", true);
                    _BoulderRadius = asNumber(_boulderthatsattached.getWidth()/2);
                    propertyChanged("_BoulderRadius", _BoulderRadius);
                }

                if ((isMouseReleased() && _gotaboulder))
                {
                    _gotaboulder = false;
                    propertyChanged("_gotaboulder", _gotaboulder);
                    _boulderthatsattached.setValue("Projectile", "_attachedtocatapult", false);

                    if (_TieinwithCatapultKit)
                    {
                        setValueForScene("Catapult Game Controller", "_CanShoot", false);
                        runLater(1000 * _FiringDelay, function(timeTask:TimedTask):Void
                        {
                            setValueForScene("Catapult Game Controller", "_CanShoot", true);
                        }, actor);
                    }
                    else
                    {
                        _CanShootNoCatapultKit = false;
                        propertyChanged("_CanShootNoCatapultKit", _CanShootNoCatapultKit);
                        runLater(1000 * _FiringDelay, function(timeTask:TimedTask):Void
                        {
                            _customEvent_NoCatapultTrue();
                        }, actor);
                    }

                    _boulderthatsattached.setX(((_SlingX - _boulderthatsattached.getWidth()/2) + (Math.cos(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)));
                    _boulderthatsattached.setY(((_SlingY - _boulderthatsattached.getHeight()/2) + (Math.sin(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)));
                    _boulderthatsattached.setXVelocity((Math.cos(Utils.RAD *((_FiringDirection - 90))) *(_MaximumPower *(Math.sqrt((Math.pow((_SlingX - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((_SlingY - (actor.getScreenY() + _SlingMiddleY)), 2))) / _MaximumWidth))));
                    _boulderthatsattached.setYVelocity((Math.sin(Utils.RAD *((_FiringDirection - 90))) *(_MaximumPower *(Math.sqrt((Math.pow((_SlingX - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((_SlingY - (actor.getScreenY() + _SlingMiddleY)), 2))) / _MaximumWidth))));
                    playSound(_FlingNoise);
                    setGameAttribute("Projectiles Left", (asNumber(getGameAttribute("Projectiles Left")) - 1));
                }

                if ((!(_expectationsmet) && _gotaboulder))
                {
                    _gotaboulder = false;
                    propertyChanged("_gotaboulder", _gotaboulder);
                    recycleActor(_boulderthatsattached);
                }
           
        });
        addWhenDrawingListener(null, function(g:G, x:Float, y:Float, list:Array<Dynamic>):Void
        {

            if (wrapper.enabled)
            {
                if (_gotaboulder)
                {
                    g.translateToScreen();
                    g.strokeSize = Std.int(_BackSlingThickness);
                    g.strokeColor = Utils.getColorRGB(153,0,0);
                    g.drawLine((actor.getX() + _BackSlingOriginX), (actor.getY() + _BackSlingOriginY), _SlingX, _SlingY);
                    g.moveTo(((_SlingX - _boulderthatsattached.getWidth()/2) + (Math.cos(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)), ((_SlingY - _boulderthatsattached.getHeight()/2) + (Math.sin(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)));
                    _boulderthatsattached.drawImage(g);
                    g.translateToScreen();
                    g.moveTo(0, 0);
                    g.strokeSize = Std.int(_FrontSlingThickness);
                    g.strokeColor = Utils.getColorRGB(255,0,0);
                    g.drawLine((actor.getX() + _FrontSlingOriginX), (actor.getY() + _FrontSlingOriginY), _SlingX, _SlingY);
                }
            }
        });
    }
    override public function forwardMessage(msg:String)
{}}


9
Ask a Question / Re: How to use realtime value in codemode?
« on: August 07, 2014, 07:40:22 am »
Hi there,

Maybe try putting your print value statements in the "always event" or have a timed event that prints values every X seconds to the console?
Can you advice me to timed event?

10
Ask a Question / Re: How to use realtime value in codemode?
« on: August 06, 2014, 09:20:56 pm »
When game start value is not refresh . How  to refresh value in realtime ?

11
Ask a Question / How to use realtime value in codemode?
« on: August 06, 2014, 08:46:57 pm »
Hello everyone
         I'm developing flash game and use accelerometer ,now I can import arbitrary  txt file  was created  by accelerometer sensor. When I compile data in game is not realtime value same accelerometer. How to get realtime  value (my sensor write speed to txt file  0.6 second )

-------this code----------
Code: [Select]
package scripts;
import com.stencyl.graphics.G;
import com.stencyl.behavior.Script;
import com.stencyl.behavior.ActorScript;
import com.stencyl.behavior.SceneScript;
import com.stencyl.behavior.TimedTask;
import com.stencyl.models.Actor;
import com.stencyl.models.GameModel;
import com.stencyl.models.actor.Animation;
import com.stencyl.models.actor.ActorType;
import com.stencyl.models.actor.Collision;
import com.stencyl.models.actor.Group;
import com.stencyl.models.Scene;
import com.stencyl.models.Sound;
import com.stencyl.models.Region;
import com.stencyl.models.Font;
import com.stencyl.Engine;
import com.stencyl.Input;
import com.stencyl.utils.Utils;
import nme.ui.Mouse;
import nme.display.Graphics;
import nme.display.BlendMode;
import nme.events.Event;
import nme.events.TouchEvent;
import nme.net.URLLoader;
import motion.Actuate;
import motion.easing.Back;
import motion.easing.Cubic;
import motion.easing.Elastic;
import motion.easing.Expo;
import motion.easing.Linear;
import motion.easing.Quad;
import motion.easing.Quart;
import motion.easing.Quint;
import motion.easing.Sine;
import box2D.dynamics.joints.B2DistanceJoint;





class Design_27_27_slingshot extends ActorScript
{
    public var _FrontSlingOriginX:Float;
    public var _FrontSlingOriginY:Float;
    public var _FrontSlingThickness:Float;
    public var _BackSlingOriginX:Float;
    public var _BackSlingOriginY:Float;
    public var _BackSlingThickness:Float;
    public var _gotaboulder:Bool;
    public var _boulderthatsattached:Actor;
    public var _SlingMiddleX:Float;
    public var _SlingMiddleY:Float;
    public var _FiringDirection:Float;
    public var _BoulderRadius:Float;
    public var _FiresinonlyoneDirection:Bool;
    public var _expectationsmet:Bool;
    public var _FiringDirectionModifier:Bool;
    public var _SlingX:Float;
    public var _MaximumWidth:Float;
    public var _MaximumPower:Float;
    public var _SlingY:Float;
    public var _TieinwithCatapultKit:Bool;
    public var _FiringDelay:Float;
    public var _FlingNoise:Sound;
    public var _CanShootNoCatapultKit:Bool;
    public var _accely:Float;

    public function _customEvent_NoCatapultTrue():Void
    {
        _CanShootNoCatapultKit = true;
        propertyChanged("_CanShootNoCatapultKit", _CanShootNoCatapultKit);
    }
    public function new(dummy:Int, actor:Actor, engine:Engine)
    {
        super(actor, engine);
        nameMap.set("Front Sling Origin X", "_FrontSlingOriginX");
        _FrontSlingOriginX = 112.0;
        nameMap.set("Front Sling Origin Y", "_FrontSlingOriginY");
        _FrontSlingOriginY = 33.0;
        nameMap.set("Front Sling Thickness", "_FrontSlingThickness");
        _FrontSlingThickness = 8.0;
        nameMap.set("Back Sling Origin X", "_BackSlingOriginX");
        _BackSlingOriginX = 64.0;
        nameMap.set("Back Sling Origin Y", "_BackSlingOriginY");
        _BackSlingOriginY = 30.0;
        nameMap.set("Back Sling Thickness", "_BackSlingThickness");
        _BackSlingThickness = 7.0;
        nameMap.set("got a boulder", "_gotaboulder");
        _gotaboulder = false;
        nameMap.set("the boulder that's attached", "_boulderthatsattached");
        nameMap.set("Sling Middle X", "_SlingMiddleX");
        _SlingMiddleX = 0.0;
        nameMap.set("Sling Middle Y", "_SlingMiddleY");
        _SlingMiddleY = 0.0;
        nameMap.set("Firing Direction", "_FiringDirection");
        _FiringDirection = 0.0;
        nameMap.set("Boulder Radius", "_BoulderRadius");
        _BoulderRadius = 0.0;
        nameMap.set("Fires in only one Direction", "_FiresinonlyoneDirection");
        _FiresinonlyoneDirection = true;
        nameMap.set("Actor", "actor");
        nameMap.set("expectations met", "_expectationsmet");
        _expectationsmet = false;
        nameMap.set("Firing Direction Modifier", "_FiringDirectionModifier");
        _FiringDirectionModifier = true;
        nameMap.set("SlingX", "_SlingX");
        _SlingX = 0.0;
        nameMap.set("Maximum Width", "_MaximumWidth");
        _MaximumWidth = 100.0;
        nameMap.set("Maximum Power", "_MaximumPower");
        _MaximumPower = 100.0;
        nameMap.set("SlingY", "_SlingY");
        _SlingY = 0.0;
        nameMap.set("Tie in with Catapult Kit", "_TieinwithCatapultKit");
        _TieinwithCatapultKit = true;
        nameMap.set("Firing Delay", "_FiringDelay");
        _FiringDelay = 5.0;
        nameMap.set("Fling Noise", "_FlingNoise");
        _FlingNoise = getSound(39);
        nameMap.set("Can Shoot (No Catapult Kit)", "_CanShootNoCatapultKit");
        _CanShootNoCatapultKit = true;
    }
    override public function init()
    {
        _SlingMiddleX = asNumber(((_BackSlingOriginX + _FrontSlingOriginX) / 2));
        propertyChanged("_SlingMiddleX", _SlingMiddleX);
        _SlingMiddleY = asNumber(((_BackSlingOriginY + _FrontSlingOriginY) / 2));
        propertyChanged("_SlingMiddleY", _SlingMiddleY);
        addWhenUpdatedListener(null, function(elapsedTime:Float, list:Array<Dynamic>):Void
        {

            if (wrapper.enabled)
            {
            var pitchydata:String = nme.Assets.getText("assets/data/data2.txt");
//trace(pitchydata);
                if (isMouseDown())
                {               
                    if (_gotaboulder)
                    {
                       //trace(_gotaboulder);
                      //  _FiringDirection = asNumber((Utils.DEG * (Math.atan2(((actor.getScreenY() + _SlingMiddleY) - getMouseY()), ((actor.getScreenX() + _SlingMiddleX) - getMouseX()))) + 90));
                        _FiringDirection = 45;
                     //   propertyChanged("_FiringDirection", _FiringDirection);
                     //   trace(_FiringDirection);

                    }

                    if ((Math.sqrt((Math.pow((getMouseX() - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((getMouseY() - (actor.getScreenY() + _SlingMiddleY)), 2))) > _MaximumWidth))
                    {
                        _SlingX = asNumber(((actor.getScreenX() + _SlingMiddleX) + (Math.cos(Utils.RAD * ((_FiringDirection + 90))) * _MaximumWidth)));
                        propertyChanged("_SlingX", _SlingX);
                        _SlingY = asNumber(((actor.getScreenY() + _SlingMiddleY) + (Math.sin(Utils.RAD * ((_FiringDirection + 90))) * _MaximumWidth)));
                        propertyChanged("_SlingY", _SlingY);
                        trace("Math.sqrt"+Math.sqrt((Math.pow((getMouseX() - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((getMouseY() - (actor.getScreenY() + _SlingMiddleY)), 2))));
                        trace("_MaximumWidth"+_MaximumWidth);
                        trace("_SlingX"+_SlingX);
                        trace("_SlingY"+_SlingY);

                                            }
                    else
                    {
                        _SlingX = asNumber(getMouseX());
                        propertyChanged("_SlingX",_SlingX);
                        _SlingY = asNumber(getMouseY());
                        propertyChanged("_SlingY",_SlingY);
                    }
                }
                 
                }
                _expectationsmet = true;
                propertyChanged("_expectationsmet", _expectationsmet);

                if ((asNumber(getGameAttribute("Projectiles Left")) <= 0))
                {
                    _expectationsmet = false;
                    propertyChanged("_expectationsmet", _expectationsmet);
                }

                if (_FiresinonlyoneDirection)
                {
                    if (isMouseDown())
                    {
 
                        if ((_FiringDirectionModifier && (getMouseX() > (actor.getScreenX() + _SlingMiddleX))))
                        {
                            _expectationsmet = false;
                            propertyChanged("_expectationsmet", _expectationsmet);
                        }
                        else if ((!(_FiringDirectionModifier) && ((actor.getScreenX() + _SlingMiddleX) > getMouseX())))
                        {
                            _expectationsmet = false;
                            propertyChanged("_expectationsmet", _expectationsmet);
                        }
                    }
                }

                if (_TieinwithCatapultKit)
                {
                    if ((asBoolean(getValueForScene("Catapult Game Controller", "_InitEndofGame")) || !(asBoolean(getValueForScene("Catapult Game Controller", "_CanShoot")))))
                    {
                        _expectationsmet = false;
                        propertyChanged("_expectationsmet", _expectationsmet);
                    }
                }
                else
                {
                    if (!(_CanShootNoCatapultKit))
                    {
                        _expectationsmet = false;
                        propertyChanged("_expectationsmet", _expectationsmet);
                    }
                }

                if (((isMouseDown() && _expectationsmet) && !(_gotaboulder)))
                {
                    _gotaboulder = true;
                    propertyChanged("_gotaboulder", _gotaboulder);
                    createRecycledActor(getActorType(0), 0, 0, Script.FRONT);
                    _boulderthatsattached = getLastCreatedActor();
                    propertyChanged("_boulderthatsattached", _boulderthatsattached);
                    getLastCreatedActor().setValue("Projectile", "_attachedtocatapult", true);
                    _BoulderRadius = asNumber(_boulderthatsattached.getWidth()/2);
                    propertyChanged("_BoulderRadius", _BoulderRadius);
                }

                if ((isMouseReleased() && _gotaboulder))
                {
                    _gotaboulder = false;
                    propertyChanged("_gotaboulder", _gotaboulder);
                    _boulderthatsattached.setValue("Projectile", "_attachedtocatapult", false);

                    if (_TieinwithCatapultKit)
                    {
                        setValueForScene("Catapult Game Controller", "_CanShoot", false);
                        runLater(1000 * _FiringDelay, function(timeTask:TimedTask):Void
                        {
                            setValueForScene("Catapult Game Controller", "_CanShoot", true);
                        }, actor);
                    }
                    else
                    {
                        _CanShootNoCatapultKit = false;
                        propertyChanged("_CanShootNoCatapultKit", _CanShootNoCatapultKit);
                        runLater(1000 * _FiringDelay, function(timeTask:TimedTask):Void
                        {
                            _customEvent_NoCatapultTrue();
                        }, actor);
                    }

                    _boulderthatsattached.setX(((_SlingX - _boulderthatsattached.getWidth()/2) + (Math.cos(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)));
                    _boulderthatsattached.setY(((_SlingY - _boulderthatsattached.getHeight()/2) + (Math.sin(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)));
                    _boulderthatsattached.setXVelocity((Math.cos(Utils.RAD *((_FiringDirection - 90))) *(_MaximumPower *(Math.sqrt((Math.pow((_SlingX - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((_SlingY - (actor.getScreenY() + _SlingMiddleY)), 2))) / _MaximumWidth))));
                    _boulderthatsattached.setYVelocity((Math.sin(Utils.RAD *((_FiringDirection - 90))) *(_MaximumPower *(Math.sqrt((Math.pow((_SlingX - (actor.getScreenX() + _SlingMiddleX)), 2) + Math.pow((_SlingY - (actor.getScreenY() + _SlingMiddleY)), 2))) / _MaximumWidth))));
                    playSound(_FlingNoise);
                    setGameAttribute("Projectiles Left", (asNumber(getGameAttribute("Projectiles Left")) - 1));
                }

                if ((!(_expectationsmet) && _gotaboulder))
                {
                    _gotaboulder = false;
                    propertyChanged("_gotaboulder", _gotaboulder);
                    recycleActor(_boulderthatsattached);
                }
           
        });
        addWhenDrawingListener(null, function(g:G, x:Float, y:Float, list:Array<Dynamic>):Void
        {

            if (wrapper.enabled)
            {
                if (_gotaboulder)
                {
                    g.translateToScreen();
                    g.strokeSize = Std.int(_BackSlingThickness);
                    g.strokeColor = Utils.getColorRGB(153,0,0);
                    g.drawLine((actor.getX() + _BackSlingOriginX), (actor.getY() + _BackSlingOriginY), _SlingX, _SlingY);
                    g.moveTo(((_SlingX - _boulderthatsattached.getWidth()/2) + (Math.cos(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)), ((_SlingY - _boulderthatsattached.getHeight()/2) + (Math.sin(Utils.RAD *((_FiringDirection - 90))) * _BoulderRadius)));
                    _boulderthatsattached.drawImage(g);
                    g.translateToScreen();
                    g.moveTo(0, 0);
                    g.strokeSize = Std.int(_FrontSlingThickness);
                    g.strokeColor = Utils.getColorRGB(255,0,0);
                    g.drawLine((actor.getX() + _FrontSlingOriginX), (actor.getY() + _FrontSlingOriginY), _SlingX, _SlingY);
                }
            }
        });
    }
    override public function forwardMessage(msg:String)
{}}


12
parseFloat() is a static function of the class Std, so to call it you must use Std.parseFloat().
special thanks rob1212

   var s:String = nme.Assets.getText("assets/data/file.txt");             
                    var l = Std.parseFloat(s);
                    var m = l+9;                   
                    trace(m);    

ืnow I can go to next step ,very exciting

13
Another function for what?

substring and timer

14
I miss to import or extend anything else?

15
Thanks you for your answering  Master rob1212.I have the last one question ,In stencyl  can I use another method or function in http://api.haxe.org/haxe/  or not ?  :-[

public var s:String = nme.Assets.getText("assets/data/file.txt");
public static function parseFloat(s){
           }
is error appear
Running command: BUILD
 - Running command: haxe Export/flash/haxe/debug.hxml
Source/scripts/Design_27_27_slingshot.hx:148: characters 28-38 : Unknown identifier : parseFloat

Pages: 1 2 3