POLALA.COM
welcome to my space
X
Search:  
Welcome to:polala.com
 HOME   controlling arithmetic operators

controlling arithmetic operators

Published by: cfz 2010-03-12
  • Peachpit: Working with C++ Operators and Control Structures::
    This mini guide covers exactly what you need to know about C++ operators (special functions that perform arithmetic and boolean operations) and control
    http://www.peachpit.com/store/product.aspx?isbn=0321481143
    HOME
    Im currently working on a game for flash with some very complex movement.
    What I need to do is to change the direction the player moves when a certain key is pressed, making it the exact opposite of the direction the player would normally.

    Example :
    up arrow key moves the player forward, when the spacebar is hit the up arrow moves the player backwards.

    So this is the code im using to move the player MC :
    if (Key.isDown(Key.UP) ) {
    if (angle == 360) {
    this._y -=10;
    }
    }

    so what needs to happen is that this._y -=10; needs to become this._y +=10;. So i thought 'ill just use a variable!', first problem was that the decision to change the operator comes from a different timeline, solved that with a _global variable, but when I entered :
    PHP: Error Control Operators - Manual::
    Jun 26, 2008 PHP supports one error control operator: the at sign (@). Currently the "@" error-control operator prefix will even disable error
    http://www.phpbuilder.com/manual/en/language.operators.errorcontrol.php
    HOME

    this._y variable_name=10;

    it didnt like it so I tried :

    this._y [variable_name]=10;

    that seemed ok, but when I tested the movie the player just wouldn't move, I thought it may be to do with the fact that the variable_name was a string variable of either "-" or "+"

    I would just re-write the code with the different operator, would seem the logical thing to do and then just change the conditions, but because there are so many movement statements that need to be controlled it would be to much code and a variable is the only logical way to control it.
    operator definition of operator in the Free Online Encyclopedia.::
    See arithmetic operators and Boolean operator. Operators may also write the job control language (JCL), which schedules the daily work for the computer.
    http://encyclopedia2.thefreedictionary.com/operator
    HOME
    Chapter 12. Functions and Operators::
    Date arithmetic operations require complete dates and do not work with You can exert more control over full-text searching behavior if you have a
    http://dewa03.unep.org/manuals/mysql/html-chapter/functions.html
    HOME

    anyone know what im doing wrong or if theres a specific way of representing operators?

    (attached a demo of what im working on)


  • Why don't you use a boolean variable, like this:

    on (keyPress.SPACE) {
    _root.SpaceDown = TRUE;
    }

    on (keyUp.SPACE) {
    _root.SpaceDown = FALSE;
    }

    if (Key.isDown(Key.UP) ) {
    if (_root.SpaceDown) {
    if (angle == 360) {
    this._y -=10;
    }
    }else {
    if (angle == 360) {
    this._y +=10;
    }
    }
    }

    I tried to peice some of it together from the code you had... and my exact AS coding is a little rusty... but that's about the jist of it.
  • 2.3. Operators: Arithmetic, Logical, and Conditional::
    The C# operators used for arithmetic operations, bit manipulation, and conditional . Each case block must end with a statement that transfers control.
    http://www.codeguru.cn/dotnet/Core.C.Sharp.and.dot.NET/0131472275/ch02lev1sec3.html
    HOME
    Programming Languages::
    Jump to Arithmeticâ Ž: Set screen Arithmetic Operators This is commonly done in control systems to align bits that are read from, or to be written to,
    http://www.wilsonmar.com/1pgmlang.htm
    HOME


  • + and - cannot be manipulated in that way. You will need to find some other solution, either through method handling (i.e. this.moveFoward(speed, isReversed)) or something like SeiferTim suggested... though my approach would be more like

    speed = 2;
    reverse = (Key.isDown(Key.SPACE)) ? -1 : 1;
    myHorzMvmnt = (Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT))*speed*reverse;


  • It would work fine but the thing is I have 36 if statements controlling the movement in comparision to the player angle, so your method would mean writing 36 else statements and leading to to much code.
    (the only reason I have 36 if statements is because I couldn't think of any mathematical calculation that would give me the movement for both X and Y in comparision to the angle of the player)
    So I need to replace + or - with a variable which can then be reversed in everystatement in one go :-/





  • Where's The Advantage In Windows Genuine Advantage?
    Stocks Bounce After S&P Joins Bear Market
    You are looking at:polala.com's controlling arithmetic operators, click polala.com to home
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about controlling arithmetic operators , Please add it free.
  • i need help majorly the three branches of government are like
  • democrats please explain the change obama is bringing and how it will help
  • help with politics and government
  • does lost in space know about the 14th amendment
  • would you be for a one world government
  • how do i change american money into other country money
  • damian green
  • which amendment is this
  • who becomes president with the president vice president and speaker of the house get killed what if they die
  • what is the current rule of taser use in canada
  • any reason the top 5 most violent cities all have democratic mayors
  • whats healthcare like in the united states
  • how is the current economic state effecting your holidays
  • if mccain was perceived as a 3rd bush term is obama now perceived as a 3rd clinton term w his appointments

  • national health insurance shouldn 039 t be universal why
  • an excellent choice hilary clinton to be sec of state
  • president bush and gas prices
  • how does a socialist government come into power
  • first lady
  • how far must the government go in balancing the tables of social equality
  • is this socialist take money from the oil companies and share the wealth with everyone who lives in alaska
  • why do we have a bicameral congress what are the reasons for having two houses in our congress
  • how many attempts have there been to assasinate obama
  • what ar the chances of the republican party backing palin for a presidential run in 2012
  • does president has full power
  • has anyone heard that obama 039 s birth certificate may be forged
  • what do think of obama backing off removing the tax cuts for the rich
  • what is an example of a country in democratic turmoil
  • About us |Contact us |Advertisement |Site map |Exchange links
    Copyright© 2008polala.com All Rights Reserved