Hey guys I'm pretty new to programming in general, I have searched and learnt as much as I can but I have no idea how to go about doing this
Essentially its like a rope that extends in the direction of a touch, but the starting location can change (and likely will). The rope itself is an array of sprites (unless thats a bad idea?). So far I can draw the line etc, and I have a clue about moving the start location but I do not know how I would:
Move the starting location without moving the entire line of sprites
Moving the line of sprites in such a way to follow a curve
Retract the line of sprites, although I imagine it would be the reverse process for moving it forward and so not too difficult if I can understand how to do the first part.
So far I know about bezier curves, vrope and have googled every search term I could think of but still dont quite know what to do.
Any help would be greatly appreciated.
Related
For my university project I am making a program to help test children's motor skills. Its basic ball catching/throwing tests, but there are certain steps involved, eg, for an underarm throw the movement goes as follows:
dominant hand swings down and back reaching behind the leg
steps forward with the foot opposite the throwing hand
ball is tossed forward hitting the wall without a bounce
hand follows through after ball release to chest level
For these detections I am initially thinking of buffering a list of points before each 'step' of positions and then checking each one over for that step to be performed.
Is there any elegant way of doing this? Any mathematical way that isn't a neural network?
My proposed method feels a bit crude, so i'd love input from anyone else.
Thanks!
Ive got - 2 on this questions so obviously i shouldn't be asking such a ridiculous question on here. Its fine. Ill figure it out.
I am making a multiplayer top down 2D game with 3d elements. All my movement, healthbars and basic functionality is working flawlessly even while hosted and playing on a server, node.js socket.io. However In this game it is possible to move the camera like in Realm of the mad god.
in case you are in doubt here is a video: https://youtu.be/4tdcxl3aZ0c?t=31s
This of course means that the players can end up being upside down with regards to each other and I cannot find a solution that works in all regards to make sure the sprites of the other players are always facing the correct direction with regards to their movement.
I have made several solution to this problem which cover most scenarios but while play testing other things we always end up noticing that the sprites sometimes face the wrong directions. So I am wondering if anyone has an answer, the logic, the fixing this problem.
Things I have tried:
Adding a gameobject to the camera to which all sprites asses their change in distance and determine their facing direction based off that information. (this leads to the players sometimes flipping erratically when the camera is moved and they as well are moving as sometimes they may be moving slower and there although moving left the camera approaches from the right and that flips them)
Adding a gameobject to the world which allows all sprites to have a fixed point to which they can measure their change in distance and therefore also know what direction to face (this worked somewhat better as they always know what direction they have to face, however once the player is upside down everything is inverted)
Emitting to the other players wether I am upside down or not in order to try to reinvert the above solution in the case I am upside down. (I could not find a good way to do this, and it got me thinking that this must be a problem people have fixed before many times and perhaps someone know of a good solution that works.)
thank you all for your input.
I seem to have found a solution for this issue that works decently well. Keeping in mind that I do not want to have the server being involved in this and I would rather have each individual sprite know its direction rather that have something heavy trying to determine this logic I came up with the following solution. May not be the best but it works. Still very keen to hear other solutions.
On my main character I have a switch case, which changes depending on the players rotation in the world. I need this switch case anyway for fixing (http://answers.unity3d.com/questions/1348301/trying-to-change-the-cameratransparencysortaxis-to.html?childToView=1348316#answer-1348316) that issue.
As the cases change I simply place the gameobject that I want the sprites to compare their distance to at 1 of 4 positions. YPos, YNeg, XPos, XNeg. Meaning that the sprite now determines its facing direction based on a gameobject that is placed in accordance with the Players position. without having to place it on the camera.
I will update if during further play tests this gives me trouble but thus far it works in the all the cases I need it to.
Still very willing to hear other solutions to this problem.
Thank you.
I want to do pathfinding on a rotating "planet", similar like the enemies do in mario galaxy, except the planets are rotating. What would be the best way to do it? The planets come in different forms, and it is necessary that I place the waypoint with code. That is because I need to do it with code for my assignment and also I want to make an object pool of waypoints that get placed on the planet the player is currently on.
So is A* the best way to go? I was thinking about the technique I should use and I thought of placing every waypoint on a vertex of the model. But some models can get pretty high in vertices, so isn't that really heavy if I have that many waypoint and then use them for path finding?
Or is there a better way of doing it? I was thinking can't you do it based on the uv's of the planet? The only thing is that the uv's have cuts so how can I tell the enemy to also check the cuts of the uv's for a shorter path?
Best way to animate planets will be to download leanTween or some similar asset and make animation by curve path + rotation.
I am making a app which draws continuous lines like a snake using Unity and SKSpriteKit (Obj-C) in Xcode (I’m making 2 versions of the same app in both):
http://i.stack.imgur.com/qA1zk.png
http://i.stack.imgur.com/484kj.png
http:// i.stack.imgur.com/QTEkC.png (Apologies for the image posts. I can't post an image/more than 2 links)
If you’ve ever heard of a game called Curve Fever, what I’m doing here is quite similar to it. I’m controlling the direction of the end of the line with the arrowkeys, whilst the end of the line automatically moves forward every frame creating an image like the one above.
However, from the 3 screenshots above, it is quite obvious that my program isn’t very efficient - every frame, I add a circle sprite to the SKScene in the place where my moving sprite is, which is why, after a while, there are over 1000 nodes on the screen, and the energy impact/memory/cpu is very high… Not ideal.
So now I’m looking for better ways of drawing the line on the screen without drawing thousands of nodes.
A while ago, a friend talked to me about how he made a similar app in GameMaker (which I have no knowledge of how to use). When I asked him how he rendered the line, he said he created something called a “surface”, and when anything moved on that surface, the old position of the sprite would still stay there - which would create lines if a circle moved across the surface.
He was rather vague about this, and I tried to do some research later, but with no success. I couldn’t find anything relevant about continuous lines, surfaces and GameMaker, Xcode or Unity.
If someone could come up with a solution like my friend was talking about, for Xcode/Unity - preferably both (or if someone could tell me what he was talking about for GameMaker), then I’d be grateful, as this would optimise my game and reduce the severe lags I get after around 30 seconds.
Also, I’d be grateful if anyone could suggest alternative solutions to this, too.
I'm using GameMaker but I have no knowledge of Xcode or Unity. I can't help you directly but I can explain GameMaker surfaces.
Surfaces in GM are objects where you can draw on instead of directly drawing on the screen. Later you can draw the surface to the screen. The main advantage of it is that you can store a surface and for example draw it again in another tick, while the screen is redrawn in every tick, or that you can change it over time.
Surfaces are basically just bitmaps where you draw on. That means it wouldn't be hard to do the same in any other environment. Most other libraries/APIs call it canvas.
In your example you would draw one circle to the bitmap in each tick and then draw the whole bitmap to the screen.
A related topic is destructible terrain as it is discussed here: https://gamedev.stackexchange.com/questions/6721/implementing-a-2d-destructible-landscape-like-worms
I saw this question on a Cocos2d forum, and I would really like to see the answer, I'm assuming its more likely to get answered here:
I was wondering what would be the best method to go about animating a stick figure running, walking, etc.
I need to have a wide and flexible range of motion, so prefer to actually animate multiple lines rather than create premade images and flip through them.
Would I use rotation or use trigonometry to figure coordinates from the angle of the moving extremities?
Any advice, direction or code snippets would be really appreciated!
You could set your own anchor points for each sprite to animate with the rotation- that way you could rotate an arm from the end of the arm just by using rotate instead of doing a lot of complicated math. Setting the anchor point also allows you to translate the sprite along that point instead of its center. Anchorpoint tutorial.
However, I think that it might be easier just to create a lot of images of the stick figure doing all of the actions. I think that n game does this and their character has a lot of animations.