Saturday, December 23, 2017

using UnityEngine;
using UnityEngine.EventSystems;

public class editSteer : MonoBehaviour,IPointerDownHandler,IDragHandler,IPointerUpHandler {
    //use for find the image center point
    RectTransform rect;
    Vector2 centerPoint;
    //ends here

    //to find whether the wheel is held or not
    bool wheelBeingHeld = false;
    private float wheelPrevAngle = 0f;
    private float wheelAngle = 0f;
    //ends here

      float maximumSteeringAngle = 200f;
    float wheelReleasedSpeed = 250f;
    private void Start () {
        rect = GetComponent<RectTransform>();
        getcenterPoint();
      
    }


    private    void Update ()
    {

        if (!wheelBeingHeld && !Mathf.Approximately(0f, wheelAngle))
        {
            float deltaAngle = wheelReleasedSpeed * Time.deltaTime;
            if (Mathf.Abs(deltaAngle) > Mathf.Abs(wheelAngle))
                wheelAngle = 0f;
            else if (wheelAngle > 0f)
                wheelAngle -= deltaAngle;
            else
                wheelAngle += deltaAngle;
        }

        // Rotate the wheel image
        rect.localEulerAngles =new  Vector3(0,0,-1) * wheelAngle;


    }



    // to calculate the center of the image
    private void getcenterPoint()
    {    //to get the position of the corners of the image in the world
        Vector3[] corners = new Vector3[4];
        rect.GetWorldCorners(corners);
        // end here
      
        for (int i = 0; i < 4; i++)
        {
            corners[i] = RectTransformUtility.WorldToScreenPoint(null, corners[i]);
        }

        Vector3 bottomLeft = corners[0];
        Vector3 topRight = corners[2];
        float width = topRight.x - bottomLeft.x;
        float height = topRight.y - bottomLeft.y;

        Rect _rect = new Rect(bottomLeft.x, topRight.y, width, height);
        centerPoint = new Vector2(_rect.x + _rect.width * 0.5f, _rect.y - _rect.height * 0.5f);
      }
    //end here and we get overselves the  centerpoint of the rect image which is stored in the centerPoint



    //for the events
    //IpointerDownHandler , IDragHandler ,   IPointerUpHandler

    public void OnPointerDown(PointerEventData eventData)
    {
        Vector2 pointerPos = ((PointerEventData)eventData).position;
        wheelBeingHeld = true;
        wheelPrevAngle = Vector2.Angle(Vector2.up, pointerPos - centerPoint);
     
    }
    public void OnDrag(PointerEventData eventData)
    {
        Vector2 pointerPos = ((PointerEventData)eventData).position;

        float wheelNewAngle = Vector2.Angle(Vector2.up, pointerPos - centerPoint);
      
       
      
        // Do nothing if the pointer is too close to the center of the wheel
        if (Vector2.Distance(pointerPos, centerPoint) > 20f)
        {
            if (pointerPos.x > centerPoint.x)
                wheelAngle += wheelNewAngle - wheelPrevAngle;
            else
                wheelAngle -= wheelNewAngle - wheelPrevAngle;
        }
        // Make sure wheel angle never exceeds maximumSteeringAngle
        wheelAngle = Mathf.Clamp(wheelAngle, -maximumSteeringAngle, maximumSteeringAngle);
        wheelPrevAngle = wheelNewAngle;

    }

    public void OnPointerUp(PointerEventData eventData)
    {
        OnDrag(eventData);
        wheelBeingHeld = false;
    }
    //end of the eventHandlers here

   

}

Friday, December 15, 2017

How to Raycast on sprite in unity 2D

 if (Input.touchCount > 0)     // If the any touch on the screen
  {
    Touch touch = Input.GetTouch(0);     //First touch

   // ray cast from camera to the sprite
    RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(touch.position),     Vector2.zero);

   // and if any sprite there and it has tag that we want......
    if(hit.collider.tag == "Tag")
    {
      // Do something
    }
    }  
    }

Friday, October 6, 2017

Why am i not getting any downloads ???

Why am I not getting any downloads??  Every fresher developers or programmer’s first question after Publishing his/her first application or game. Even I asked myself the same question when I published my first app on play store. So after doing so much of hard work of months finally a day comes when you publish your first application and keeping eye on the reports every second for like whole day and getting nothing at all and you keep asking yourself, did I do something wrong, why am I not getting any downloads. Well my friend that is not your mistake. It is not anybody's mistake. We are developers, we can build things but the only thing we don't know is advertisement. So we build this app and worked our ass off like a month and the only thing we are missing is advertisement. When I built my first app and published all I was thinking was “this app is made by me, it does not require any type of advertisement”.  But trust me you are wrong at this point, I was wrong because it was my first step and I had to learn everything in the commercial world.
Let me ask you a question. Why these big movies need promotions? I mean every person in this world knows about the movie “The Transformers”. It has more than three parts I think. It is so famous so why creators invested a butt load of money on promotions. And let me tell you something even “GTA V” cost £175 million to make and market and mostly half of the money went to the promotions for the game. So the point is it does not matter how good your application is or how talented you are if people don’t see it, it not going to be famous. Let me tell you something, I assume on some level you download and play some game from play store, IOS store or Steam or any other service. And I think you have seen some games are shit and got like millions of downloads, and you ask yourself how is this even possible. Well it is the magic of advertisement my friend. People buy shits if they see it but if they don’t see it, nothing is going to happen.          
So I think I have proved my point. Now let’s talk about how to advertise your product. Well you are a developer and a fresher and I don’t think you have millions of money for investing on advertisement. Well nothing to worry about. First of all you have to find right audience. And first and free option is tell your friends to use it. But in my experience they will uninstall it within two days. Trust me this happens. I punched my best friend on face because of this. But that is another story to tell. But trust me and do it. Before taking next step it is the most important step to let your friend use this and take some feedback from it. And you can make some steps to improve your app and update it. And now one thing you can do is make yourself a little bit famous. Youtube can do that. Uploading some videos and get good amount of subscribers is not a bad idea but keep it in mind that if you are going to make game and promote it on youtube than you should have right audience there. It is not going to work if you have some famous channel for songs and you are promoting your game in it. It is not going to work. But if most of audience are gamers than it can be great. Now before you publish, you can make some trailer to make some excitement in people. So making small videos on games and promote trailers will work. By that you already have people waiting for your product in market and that is a good point.
These are some free points to do promotions and another option is find a publisher for your application but it is not easy. I tried like hundreds of sites to promote my app, sending them message but no replies at all. But you know what it is not bad because if your apps get famous on some level then at some day you can sit on some chair and say “I should buy a lemo”. And trust me you will. All you have to do is to trust yourself and learn from your mistakes. It takes courage to accept the mistake and work on them. Coward people blame GOD. In my opinion make mistake and learn from them till you are 25. I can be wrong because I am 21.
Now back to promotions the last option is to invest some money on your app and I am not saying like millions. I am saying $50 to $100. And I think everyone can afford that. Best options are Google adsense and facebook promotions. Now first lets talk about Google adsense. You can make campaign from Google adsense and promote your app. It will take like 5 to 10 minutes to make a campaign and start it. And the best thing is you need $10 to start that. And in that money you can get like 200 downloads. Isn’t that great. Same thing goes with facebook. You have to make a facebook page and make a campaign and start it. And I think you can find some tutorial for that on youtube and other sites as well.
 Now the worst thing and nightmare of every developer comes here. After you getting downloads, you start getting uninstalls too. Well they give you users but it’s all on you that how you can engage the user and make him/her keep the application. So before investing big amount of money you should really get some feedback for you app so you can find some of your mistakes and work on them. So good luck and never give up.              

Monday, August 28, 2017

My First Game on Play Store without spending a penny.

Hello friends, first of all i just want to say that a have successfully uploaded my first game application on play Store. well congratulation to me......

you can find my game in the link below

 https://play.google.com/store/apps/details?id=com.Deep.HighwayTransport

I just want to share my experience while i was making the game. well i am a programmer. But when i was making the game i was programmer/game designer/audio manager/ pretty much everything in this game. I love to code. well this is my first game and all i had was 200 rupees in my pocket and a laptop. thanks to Unity 3D. it is free to use and if you use this on its full potential you can get some great results out of it. well enough of this lets get back to game.
first i wanted to make a simple parking game and i made it. but that was too heavy for the mobile devices.
Oh, i forgot to tell you that i am an intermediate in game designing and i learn unity from google and YouTube. Cool haaahhhh.
so i was making this game and i had no idea that how to make this for mobile phones because it was very good in computer and i have AMD 2GB graphics in my computer. but the frame rate in mobile device this is some other Story. you have to deal with memory and other stuff like frame rate etc.
 because of you can find so many parking game on play  Store.
I thought, why not make some driving type game for long road. and i found everything on Asset Store and i started to make the game. there you go.

my first problem was FPS. it took me two days to find how to get good FPS in mobile games.
well the camera rendering should be forward, and culling mask to "default" from "everything" in camera setting. that's all in my case.
so i got good FPS in my game and i was very happy that day. Big winning haaahhh.

well i am from India and in India if you are doing something different its not acceptable by society. you have to get some government job for that.
my mother is in support with me and my father too. but some times my father tell me to leave all this and get a real job like GOVT. but on the other hand my mother believes in me and that's all that matters. i am telling you this because if you are from India and if you want to try something new you have to ignore society for that. That's all.

sooooo back to game.

so FPS was good in mobile device. next challenge, i wanted to give user a different experience in each vehicle. when i went to gym at evening i always noticed how suspension works of every vehicle that passed nearby me. and Unity has some good suspension script for that. there you go. problem solved.
if you want to learn how this works you can check this on my Youtube channel. i made some video tutorial for that.
https://www.youtube.com/watch?v=-2M8YARVHmE&list=PL10dMmkQfOQl2-7IwVl3KRN2GMqIaCqpG

yes i am Youtuber too.

so suspension was good and i found good long roads and free cars on asset store and i use all the free asset because you know 200rupees. 1300rupees to go for developer fee on playStore.

Yes, Everything in this game is free.

now the next problem was the lightning and if you use real time lightning it can cost you a big amount of processing power. so always use baked lightning.
I put high quality shadows in game it cost some processing power but it make your game more realistic. and i did not want to loose that. so shadows win i loose. after spending i whole day on doing research on shadows i thought it is best to put some quality choosing option in game and i did.

the next next problem was the biggest pain in my ass. roads becomes blurry on distance and i could not find any solution for two days. but finally i did it. there are some texture setting for mobile devices. if you have same problem let me know i can make a tutorial for that.

the biggest challenge for me to keep track of every script in my game since i am a single developer and i had to deal with every problem it was very hard to keep track but i made diary for that and it was successful.

I often hear from people to get a job and do this in side work and trust me it is very hard for me to find that no one believes in me. until you get some success you have to hear that. i am writing this blog and at this time i have 400 rupees in my pocket and 7rupees i made from my game because its been three days since i uploaded my game on play store. it is hard to find your audience but once you do that's all you need. i am still searching my audience till this time and i believe i will find some day.

...no need to pity on me....because if you are reading this blog that means you are a beginner and i am a little bit but successful than you ....hahha....

so back to the game....

keep a diary and always learn something new from other people because it is important. i always observe some new ways to write code from people. no code is perfect you have to make it good as much as you can. that's what matters.

so next challenge is to make some levels and test the game. i told to some of my friends to play
and give me some feedback. i never satisfy from my work i just want to make it more good that is my quality.
So my cousin Rohit was sick of this game because god knows how many times he played it.
and every time i forced him to play this. one other friend Rajat helped me a lot.
 my other friend keshav also helped me a lot for this.
he has a company for game. and he launched more than one game on play store. 

so scripts done and other things were good and the final game reaches to  48MB.
next challenge is to put some advertisement in my game i used admob for this.
it is good service. Google provides it. easy to install and everything was clean.

one last thing was google does not accept the indian dabit cards.....Mr Sunder pichai......do something man not every person has credit cards and bank account in international banks.....please do something.....


i borrowed credit card from one of my friend and did the payment process. all good....happy happyyyy....

as you know i am a single developer and i did much of the work but some bugs are there you wont notice maybe you will. but i will fix them in my next update.

the now the problem was car AI. how to work with this. i made a simple AI for that.
it took me two days to figure that out. still not perfect. if you are making car AI i want you to dig a little bit about bazzier curves.
so i did not know about bazzier curves that time and i still dont know much but i used the road for the path the cars get some information about there position on the road and try to keep them self on that track.
i used rayCast because of the roads side tree were long so i used them to keep track by raycast.
RayCast is a cool feature in unity you should know more about it.
so AI was done but i am thinking to change this in the next update because it wasn't that good.
everything was done and i was sitting in my bed and thinking what to do now.
trust me whenever i thought to publish this i was having panic attacks. that was hard for me to control and get through this but i did. i had more than three panic attacks in three days before publishing the game. but it was normal. In my advice do some meditation to calm down.
you freak out when ever you do something new. and you should be.

i  published game without thinking of anything and it was a great experience.i learned a lot from this and now i am working in multiplayer game. i will share my story other time when it will complete.

right now i am making nothing from this game but i learned a lot from this and that what matters.
my family still thinks that i should get some real job instead of sitting in my room and putting my head in laptop. but i believe that someday it will give me some success.
keep calm and work and never look back that what it takes.




    




 

     


   


Friday, August 25, 2017

highway transport Privacy Policy
This privacy policy has been compiled to better serve those who are concerned with how their 'Personally Identifiable Information' (PII) is being used online. PII, as described in US privacy law and information security, is information that can be used on its own or with other information to identify, contact, or locate a single person, or to identify an individual in context. Please read our privacy policy carefully to get a clear understanding of how we collect, use, protect or otherwise handle your Personally Identifiable Information in accordance with our website.

What personal information do we collect from the people that visit our blog, website or app?

We do not collect information from visitors of our site.
or other details to help you with your experience.
if its asking for any app permission you have right to decline it.



How do we protect your information?

We do not use vulnerability scanning and/or scanning to PCI standards.
We only provide articles and information. We never ask for credit card numbers.
We do not use Malware Scanning.
      We only provide articles and information. We never ask for personal or private information like names, email addresses, or credit card numbers.

Do we use 'cookies'?

We do not use cookies for tracking purposes

You can choose to have your computer warn you each time a cookie is being sent, or you can choose to turn off all cookies. You do this through your browser settings. Since browser is a little different, look at your browser's Help Menu to learn the correct way to modify your cookies.

If you turn cookies off, Some of the features that make your site experience more efficient may not function properly.that make your site experience more efficient and may not function properly.


Third-party disclosure

We do not sell, trade, or otherwise transfer to outside parties your Personally Identifiable Information unless we provide users with advance notice. This does not include website hosting partners and other parties who assist us in operating our website, conducting our business, or serving our users, so long as those parties agree to keep this information confidential. We may also release information when it's release is appropriate to comply with the law, enforce our site policies, or protect ours or others' rights, property or safety.

However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.

Third-party links

Occasionally, at our discretion, we may include or offer third-party products or services on our website. These third-party sites have separate and independent privacy policies. We therefore have no responsibility or liability for the content and activities of these linked sites. Nonetheless, we seek to protect the integrity of our site and welcome any feedback about these sites.

Google

Google's advertising requirements can be summed up by Google's Advertising Principles. They are put in place to provide a positive experience for users. https://support.google.com/adwordspolicy/answer/1316548?hl=en
We use Google Admob Advertising on our App.

Google, as a third-party vendor, uses cookies to serve ads on our site. Google's use of the DART cookie enables it to serve ads to our users based on previous visits to our site and other sites on the Internet. Users may opt-out of the use of the DART cookie by visiting the Google Ad and Content Network privacy policy.

We have implemented the following:

We, along with third-party vendors such as Google use first-party cookies (such as the Google Analytics cookies) and third-party cookies (such as the DoubleClick cookie) or other third-party identifiers together to compile data regarding user interactions with ad impressions and other ad service functions as they relate to our website.

Opting out:
Users can set preferences for how Google advertises to you using the Google Ad Settings page. Alternatively, you can opt out by visiting the Network Advertising Initiative Opt Out page or by using the Google Analytics Opt Out Browser add on.

COPPA (Children Online Privacy Protection Act)

When it comes to the collection of personal information from children under the age of 13 years old, the Children's Online Privacy Protection Act (COPPA) puts parents in control. The Federal Trade Commission, United States' consumer protection agency, enforces the COPPA Rule, which spells out what operators of websites and online services must do to protect children's privacy and safety online.
We do not specifically market to children under the age of 13 years old.
Do we let third-parties, including ad networks or plug-ins collect PII from children under 13?

CAN SPAM Act

The CAN-SPAM Act is a law that sets the rules for commercial email, establishes requirements for commercial messages, gives recipients the right to have emails stopped from being sent to them, and spells out tough penalties for violations.
We collect your email address in order to:

To be in accordance with CANSPAM, we agree to the following:

If at any time you would like to unsubscribe from receiving future emails, you can email us at
and we will promptly remove you from ALL correspondence.

Contacting Us

If there are any questions regarding this privacy policy, you may contact us using the information below.
Highway Transport(Game)
jodhpur, Rajasthan 342005
India
kkuldeeppsinghh@gmail.com

Last Edited on 2017-08-25

Sunday, March 19, 2017


here is the coding for Android device connection to the Bluetooth Module

also see my first game on play Store without spending a penny
http://tecnologia5853.blogspot.in/2017/08/my-first-game-on-play-store-without.html




pro->

#-------------------------------------------------
#
# Project created by QtCreator 2017-03-19T09:50:06
#
#-------------------------------------------------

QT       += core gui
QT+= bluetooth

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = B_t
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

CONFIG += mobility
MOBILITY = 






mainwindow.h   ->


#ifndef MAINWINDOW_H
#define MAINWINDOW_H


#include <QMainWindow>
#include<QBluetoothDeviceDiscoveryAgent>
#include<QBluetoothSocket>
#include<QListWidget>




namespace Ui {
class MainWindow;
}


class MainWindow : public QMainWindow
{
    Q_OBJECT


public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();


private slots:
    void on_find_clicked();


    void on_on_clicked();


    void on_off_clicked();
    void deviceDiscovered(const QBluetoothDeviceInfo &device);




    void on_listWidget_itemClicked(QListWidgetItem *item);


private:
    Ui::MainWindow *ui;
    QBluetoothDeviceDiscoveryAgent *agent = new QBluetoothDeviceDiscoveryAgent;
    QBluetoothSocket *socket;
    QString string;
   bool k = false;
};


#endif // MAINWINDOW_H 






mainWindow.cpp    ->

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QtBluetooth>


//RX -> tx
//tx -> Rx
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(agent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
            this, SLOT(deviceDiscovered(QBluetoothDeviceInfo)));
    agent->start();


   socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);






}


MainWindow::~MainWindow()
{
    delete ui;




}


void MainWindow::on_find_clicked()
{ ui->listWidget->clear();
    agent->stop();
   agent->start();


}


void MainWindow::on_on_clicked()
{
   socket->write("h");
}


void MainWindow::on_off_clicked()
{
   socket->write("b");
}


void MainWindow::deviceDiscovered(const QBluetoothDeviceInfo &device)
{
    ui->listWidget->addItem(device.address().toString());
}




void MainWindow::on_listWidget_itemClicked(QListWidgetItem *item)
{
 string =item->text();


 ui->listWidget->addItem(string);
 static const QString serviceUuid(QStringLiteral("00001101-0000-1000-8000-00805F9B34FB"));


   socket->connectToService(QBluetoothAddress(string), QBluetoothUuid(serviceUuid), QIODevice::ReadWrite);


} 





main.cpp   ->
 



#include "mainwindow.h"
#include <QApplication>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();


    return a.exec();
}






mainwindow.ui->
 
 
 
 
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>480</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidget">
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
     <widget class="QPushButton" name="find">
      <property name="text">
       <string>find</string>
      </property>
     </widget>
    </item>
    <item>
     <widget class="QPushButton" name="on">
      <property name="text">
       <string>on</string>
      </property>
     </widget>
    </item>
    <item>
     <widget class="QPushButton" name="off">
      <property name="text">
       <string>off</string>
      </property>
     </widget>
    </item>
    <item>
     <widget class="QListWidget" name="listWidget"/>
    </item>
   </layout>
  </widget>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>
 
 
you can buy here