Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

A combination of a very simple player movement script and a camera movement script

i dont do well with creating movement. Did you use rb.MovePosition, rb.Velocity or something to this effect?

Not sure if this will help I but here's what I did, access the Input for the Horizontal and Vertical Axis and then use transform.Translate to move the player based off those inputs. The camera script then just makes that movement look smoother

Ive generally heard that transform.Translate doesnt work too well so that's quite surprising but cool! How did you set up your  camera if you dont mind me asking? I usually just create a camera movement script that gets the player's current location, minus 10 on the player's z axis

Yeah in general, its probably not best to use transform.Translate in most cases because with that, issues with collision can occur e.g. players can go out of the bounds of the level pretty easy that way. In the case of my game, it isn't really a problem because I just clamp my players movement to within the arena bounds so it can never escape and I don't have to deal with the extra hassle that rb.MovePosition and rb.Velocity sometimes has. As for the camera, I learnt how to do it from Brackeys but modified it for 2D use, this should be the link for the video: youtube.com/watch?v=MFQhpwc6cKE. Basically you just get the position of the player relative to the camera's viewport and then update the camera's position to the position of the player using SmoothDamp so that there is a delay and doesn't follow it instantly.

Okay cool thanks!

Anytime! Thanks again for playing! As for your first comment, I've never released a game on Steam, IOS, or Android so I'm not sure if I will, but seeing as a lot of people say that they would like to see this on mobile, I might give that a shot. Do you really think this could be viable as a mobile game?

Oh absolutely. It isn't really even that complicate d a process. I made a super tiny game in like a week a few years ago just so i can learn how to ship a game to IOS. You can ship it, as is. Just attach buttons to the screen and continue porting it to the app store. You need to have a developer profile on apple to ship games and it's like 100$ a year but if youre continuously putting out games on there, it's totally worth it. Especially to throw that on your resume if youre looking into game dev jobs. One thing for porting to the IOS store is that you need XCode which ive only found to be on MAC. There isnt another way that I know of but hopefully there is something else you can use if you dont have a MAC or maybe you dont even need xcode. Something to look into.