May 18, 2016 at 5:00am UTC
I am fairly familiar with c++ and a few other languages. I was wondering where would i need to start with coding my own simple app. I tried looking different things up but there is so much different information out there it can be overwhelming. I am not talking about coding 3D mobile games but simple 2D games. I just need to be pointed in the right direction.
Thank you!
May 18, 2016 at 7:05am UTC
My tip: start with java. its syntax is like c++!
https://www.processing.org/
The TURTLE syntax is quite simple to work in 2D.
I have already made an example class you can use!
The idea of the turtle class is : you have a turtle with a pen on the white paper and you can give him commands like "go forward 10 pixels", "turn left 45 degree", "look at a turtle" or "look at a point x/y". It's like using a circle and a ruler to create your scetches on paper.
Source:
https://www.dropbox.com/sh/94bii0pq4selq6y/AADDnmwp3izZSFSWy8oUSTo4a?dl=0
Here are some code snippes:
// Creates an instance of the turtle class. In java is no delete or free necessary.
Turtle t = new TTurtle();
// dg abbr. degree : sets the absolute degree of the turtle. 0 is bottom, 90 is to right, 180 top and 270 to left. of the screen.
t.dg(10);
// deliveres the current orientation
float f = t.dg();
// Sets the turtle on the given point
t.xy (10, 20);
// Get the x, y position of the turtle
float x = t.x();
float y = t.y();
// Every turtle has a radius. dc() draws a circle in the size of the radius. the turtle is in the middle of the circle
t.ra (50);
// Get the radius
float ra = t.ra();
// Pen up! In this case the turtle don't draws a line if the commands forward (fw) or backward (bw) are used. It moves!
t.pu ();
// Pen down! If fw() or bw() is used the turtles draws a line during motion.
t.pd ();
// Turns the turtle 10 degrees to left from it's current orientation
t.lt (10);
// Turns the turtle 10 degrees to right from it's current orientation
t.rt (10);
// Forward: The turtle moves 100 pixels on the way of it's orientation (degree)
t.fw (100);
// Backward: The turtle moves 100 pixels backwards against it's orientation (degree)
t.bw (100);
// Center: Centers the turtle to the middle of the screen and degree = 0
t.ct ();
// LookAt : The turtle should look to another turtle. New orientation point!
t.la (t2);
// LookAt : The turtle should look to a point. New orientation point!
t.la (p);
// PlaceTo: Sets the turtle to the position of another turtle. Degree is the same as before.
t.pt (t2);
// PlaceTo: Sets the turtle to the position. Degree is not touched.
t.pt (p);
// Draw Circle: Draws a circle arround the turtle with the radius set with rd()
t.dc ();
// Draw Circle: Sie soll ein Teilkreis von/bis ihres eigenen Radius zeichnen
t.dc2 (45,90);
// Dot: Draw a point. pu() is not considered.
t.dt ();
// Distract: Distracts or attracts to another turtle. The border is the radius of the turtles.
t.dt (t2);
// Distance: Get the distance between two turtles.
float d = t.di(p);
// IsInCircle: Is true if the point is within the area of the turtle's circle
boolean b = t.ic(p);
// IsInCircle: Is true if the turtle is within the are of another turtles circle
boolean b = t.ic(t2);
May 18, 2016 at 8:16am UTC
Thank you! I'll give it a go.
May 18, 2016 at 8:40am UTC
If you're trying to start a mobile 2D game in C++, maybe you could try cocos2dx.
It would be easy to set up.
May 18, 2016 at 9:12am UTC
hi liuyang, basics are important for a novice! if one can not draw circles, lines it's impossible to reach perfection in paintings. I am not defending my simple code! This is not the important point.
happy codings! ^^
May 20, 2016 at 1:19am UTC
You are right Necip, but I believe he just want to start quickly lol.
May 20, 2016 at 3:43am UTC
Yeah, I just wanted a quick start. I'm a faster learner and I learned a lot of the stuff on the fly.