• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About anupgupta

  • Rank
  1. Hello,   I am using Unity5 for making a 2D game like this one: https://www.youtube.com/watch?v=k4vn85dfm9Y   i have been able to draw the splines and make the player follow..i have been trying to draw multiple splines and attached them together like chaining one spline to other at runtime. but the issue i am facing it where the first line ends and the second line starts do not math with respect to angle.   Any ideas how can i draw a smooth infinite spline line like the above game.  
  2. We are currently working on a Third person Shooter game using unity, where the zombies would always be coming in the level and attacking the player. we though of creating 10 locations on a map and the game would start in any of the 10 locations which the user would select from the menu. the player would have to clear the level he is playing by killing all the zombies and keep getting experience, thus he would gain experience and his level would increase(level 2, 3, 4, 5...so on) and so would the level of the zombie..it would be endless.   the missions will spawn in any of the 10 locations, 2 or 3 missions at a time pops up on the map in menu.   I was thinking about the level progression and would like he and advice on it.   these are the parameters in my game for level progression.   1. player has to kill zombies and gain experience. for example, say player is at level 1 and he has to gain 100 experience to go to level 2, thus to go level 3 he may need 125 XP and so on. 2. as the level of the player progresses,so would the level of the zombies will increase, the players health would not reduce fast when he is taking damage from zombies, zombies would find to hard to kill the player and player would find it hard to kill the zombies, or if a zombies with a higher level than that of player comes, then player take more damage and so on. 3. there are around 15 weapons (machine gun and shot gun) in the game store, player will have one primary and one secondary weapon in his inventory, and he can buy weapons from in game currency and keep on upgrading the weapons he is playing with in game currency. and the upgrading could go endless as long as the player plays the game. with weapon upgrading the damage parameter of the gun would increase.   I would like to know how is level progression managed in the games and what approach to follow in such a situation, so that the balance is maintained in the game.   Any Suggestions would be of great help !!!   Cheers
  3. Hello, i wanted to discuss about the objective system, for the game i am currently working on in unity. The character would roam around in a city just like in GTA, and depending upon the vehicle he picks up in the game, like a normal Taxi, Ambulance, police car, bus etc, he would get an objective/task to complete..like pick up a character from a point and drop at other point in the game and then earn cash after the objective is completed. so now i have different vehicles and different objectives depending on the vehicle he picks. Does anybody have an idea, about how can this objective system be stored and keep track of it. Any Suggestions Please.  
  4. i have written a camera script in Unity3D to rotate on swipe in left, right, up or down direction and then slow down gradually. and my camera is looking at the car..while rotating rotating around it. the only thing i was doing is to clamp the value of the camera rotation when the user swiped up or down..because i don't want the camera to go above the car or under the car while rotating. i tried this code for clamping..but in vain Vector3objRot = cachedTransform.rotation.eulerAngles; float clampValue = Mathf.Clamp(objRot.x, 20, 50); cachedTransform.rotation.eulerAngles.Set(clampValue, objRot.y, objRot.z); am attaching my camera script..if you guys could help me out to figure it out. Any suggestion Please.   [attachment=22207:CameraScript.txt]
  5. image Stretching

      the texture co-ordinates in the x direction are being generated with respect to the terrain vertices (hillBottomVertices[i]) which are being created as the vehicle moves ahead in the x-direction how do i make sure that the texture co-ordinates in the x direction are close to 0...or maybe reach 256 (texture size = 256) and then reset.
  6. image Stretching

        .. yes..i did try to debug it and gather much of the data i could with respect to the vertices and texture co-ordinates which are being generated, and trying to make some meaning out of the data. though i think the code area: //get the hill texcoordinates for(short i = 0; i < MAX_SEGMENTS; ++i) { //calculating texture co-ordinates CCPoint pt = hillBottomVertices[i]; hillBottomTexCoords[i] = pt * (1.0f / terrainBottomTexSize); hillBottomTexCoords[i].y = 1.0f - hillBottomTexCoords[i].y; CCLOG("point: %f %f", hillBottomTexCoords[i].x, hillBottomTexCoords[i].y); } the texture coordinates values are like  point: 0.937500 0.594344 point: 0.937500 1.000000 point: 1.093750 0.565063 point: 1.093750 1.000000 point: 2.031250 0.347375 point: 2.031250 1.000000 ...so on   point: 166.875000 0.280531 point: 166.875000 1.000000 ... till   point: 260.937500 0.308594 point: 260.937500 1.000000  .. until the X co-ordinates goes beyond 256 which is also the size of the texture(size = 256) ..that the stretch starts to appear. As i move ahead the x co-ordinates keeps on increasing and the texture goes on stretching more.
  7. image Stretching

      my bottom texture image size was 512x512 and top texture size was 32x32 .. that i did to scale down the textures to make it look appropriate on the screen.        just roughly what i am doing is i have calculated 10 points(MAX_HILL_POINTS) which are 200 pixels apart of each other and then divided the whole 10 points into 100 segments (MAX_SEGMENTS)..and then in the update i keep checking if the points go outside screen then delete the point from the left and then add one point to the right and recalculate the terrain and thus this gives me endless terrain. the new point which is added is also 200 pixels apart in x and random in y in a given range. and the cardinal spline algorithm gives me a smooth curve across points(100 segments). i guess the issue could be in the generatecoordinates() function..but am not sure and need help to understand it.   the 200 is added only when one point is deleted and when the next is added..thus every point added is 200 pixel apart in X direction and random in Y direction between a set range.   checking of all the 10 points is done every frame if any of the point is gone outside screen, and if it goes outside the screen then delete the point and add a new point as the next point (getTerrainNextPoint) to the hill points array and then recalculate the whole terrain again and map the texture on it. thus with only 10 points divided into 100 segments i get a constantly generated terrain which is endless.     ?generally, though i have now tried to follow a tutorial for texture mapping on the terrain and i revised my code..here is the link : http://www.codeproject.com/Articles/727918/d-Textures-in-cocos-d-x-V   but the problem remains as it is..the terrain bottom texture still gets stretched even after implementing this tutorial. Attaching the revised code ([attachment=21149:terrain.zip]) for your reference and to get some inputs for this query.   Please suggest something or if you have a better way of doing it do let me know.   .. the problem i am facing is in texture mapping. i guess   [attachment=21147:IMG_0181.png]    [attachment=21148:IMG_0186.png]
  8. Hello   I am facing a peculiar issue in my game, i am currently making a game which is an endless car driving game using cocos2dx and box2d for iOS platform.   [attachment=21145:IMG_0176.PNG]    [attachment=21146:IMG_0179.PNG]   As you can see the ground below, initially when i start the ground image is fine, but as i progress through the game driving continuously, the ground image starts stretching.    I am also attaching the reference code of the ground(terrain.zip), so that i can get some inputs as to where the problem could be.   Any Suggestions
  9. Hello   i am currently working on a game like hill climb racing. here is the link of what i have made till now:  http://www.youtube.com/watch?v=UTDCumYnlfM&feature=youtu.be   here is the terrain making code:   #define MAX_HILL_POINTS 30 CCArray *hillInfoArray; struct hillStruct : public cocos2d::CCObject { cocos2d::CCPoint point1; cocos2d::CCPoint point2; b2Fixture *fixture; };   void CTerrainLayer::generateHillPoints() {  //create ground b2BodyDef groundBodyDef; groundBodyDef.position.Set(0, 0); //bottom-left corner groundBodyDef.type = b2_staticBody;   groundBody = worldRef->CreateBody(&groundBodyDef); groundBody->SetUserData((void*)TAG_GROUND);      //slopes     CCPoint point1 = ccp(0, 100);     for(short i = 0; i < MAX_HILL_POINTS; ++i)    {         CCPoint point2 = ccp(0, 0);         hillStruct *hillData = new hillStruct;         float val = RandomFloat(0, 10);         point2.x = point1.x + 25.0f;         point2.y = point1.y + val * cosf(point2.x / 200.0f * b2_pi);         b2EdgeShape groundShape;         groundShape.Set(B2VEC_FROM_CCPOINT(point1), B2VEC_FROM_CCPOINT(point2));         hillData->fixture = groundBody->CreateFixture(&groundShape,0);         hillData->fixture->SetDensity(5.0f);         hillData->fixture->SetFriction(0.5f);         hillData->fixture->SetRestitution(0.2f);                //hill info data         hillData->point1 = point1;         hillData->point2 = point2;         hillInfoArray->addObject(hillData);         point1 = point2;     }     } hillInfoArray stores all the points of the hill, and as the screen moves new points are created and points going outside screen gets destroyed at runtime.   i have made the terrain as an b2EdgeShape, i wanted to know how can i wrap my own custom texture on the hills/ground which have an irregular shape.   Any suggestions Please.
  10. Hill Climb Terrain

    what i am keen on knowing is how do i generate a fixed patterned endless terrain. so, even if i reset the game, the pattern of the terrain is same as before and endless.
  11. Hill Climb Terrain

    Hello Alvaro,   Please can you explain in a more detail way..with some samples. :)
  12. Hello   Iam making a game similar to hill climb racing game for iOS and andriod. Below is the link.   https://www.youtube.com/watch?v=NoBjjcMyjbE   I was kind of wondering how to make a endless terrain, keeping the terrain structure/pattern same everytime, even if the user resets the game and plays again. not like a random terrain generation..but generation one terrain with same pattern, but endless. similar to the game link above.     Any Suggestions. 
  13. yes Pufixas..that is exactly i am looking for.   thank you for the response..i will try it out and get back soon.
  14. hello   i am current making a game for iphone and was facing one query which i thought i might discuss here.   i have a sprite(cannon) which is placed at say position(100,100). my player starts walking after i tap my screen and collides with the cannon. After that my player get positioned in the cannon and my cannon starts to rotate say 0 - 60 angle and back and forth. after the user tap's the screen again the cannon get's fixed at whatever angle it is currently rotating, and then the player gets fired from the cannon.   the area i am stuck is, after the angle change of the sprite (cannon), how do i get the sprite (cannon) top point from where the player will get launched, beacuse the position of the sprite (cannon) is same(100, 100), but now the angle is changed.   Any suggestions.
  15. Side scrolling Game

    so do i need to have some procedural terrain generation..and put the holes randomly.
  • Advertisement