Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static float getActionSpot(int _direction, int _distance, float _x, float _y, char _type, float _xOffset,
            float _yOffset) {

        // Palautetaan x- tai y-arvo _typen mukaan
        if (_type == 'x') {
            return _x + _xOffset + (float) Math.cos((_direction * Math.PI) / 180) * _distance;
        } else {
            return _y + _yOffset + (float) Math.sin((_direction * Math.PI) / 180) * _distance;
        }
    }
}