Added: 4 months ago
From: oyyou91
Views: 1,618
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (30)

Sign In or Sign Up now to post a comment!
  • Comment removed

  • I fucking love you. Been trying to do this in my uni coursework thank you!

  • How do I make the camera stop moving beyond the edges of my level?

    Can you make a tutorial?

  • Comment removed

  • @oyyou91  Could you send me the source?

  • Christmas is over, that means vids r comming soon, i cant wait :D

  • Can´t wait for the rest of your vids :)

  • Thank you, thank you, thank you! Best tutorial on 2D-camera so far.

  • This tutorial was awesome. I can't wait til you make more. I've looked all over for a 2D camera tutorial like this. This saved a lot of frustration. Like in some other comments, collision detection for objects that are not rectangles would be neat. Thanks so much!

  • First I tried to implement it to my project and couldn't figure it out, now after two days of meditating, It happened and works like a charm! Thank you! :)

  • this is a really good and simple tutorial. Good job

  • Great tutorial! I would like to ask you if you could make a tutorial about per pixel collisions ?

  • And I almost forget. There are a lot of people who make videos about programming, but then they suddenly stop responding to comments, stop recording more videos and then people dont know what to do if they followed it. So I hope you won't stop doing tutorials like that because they're very helpful. =)

  • @MelbowPlay I am staying and will keep trying to help with comments :3

    And what you said in your previous comment is what I will be returning with.

  • Hi, your tutorials are very helpful for me. I know its your last video until after Christmas. But after that can you make some tutorials about how to use this scrolling background more in-game. I mean placing objects which I can collide with, then scrolling it. You know I just mean if you can make some tutorials how to make complete playable level like in Mario. It will be very helpful, thanks.

  • Im making a top down shooter also, and i used the code, but my set up is different. I have the camera class, Game1 class but also a Soldier class. I draw the soldier in the Soldier class, and for some reason it doesnt let me use SpriteBatch.Begin(); in my soldier class, and also in my Game1 class that BlendState doesnt even show up on my list. Could u please help? 

  • @Armadillopants92 Okay so go to your camera class and make this change on your update method

    public void Update(GameTime gameTime, Soldier soldier)

    {

    centre = new Vector2(soldier.spritePosition­.X + (soldier.spriteRectangle.Width / 2) - 400, 0);

     transform = Matrix.CreateScale(new Vector3(1,1,0)) * Matrix.CreateTranslation(new Vector3(-centre.X,-centre.Y,0)­);

    }

    You will also need to make your soldier position and rectangle public.

    *See next comment*

  • @Armadillopants92 Next you need to make the adjustment in your Game1 class.

    Find

    camera.Update(gameTime, this);

    and replace it with

    camera.Update(gameTime, soldier);

    You don't need to do SpriteBatch.Begin();  and .End; in the soldier class, only in the Game1 class.

    I hope this makes sense to you.

  • @oyyou91 no, no sorry i didnt elaborate more, i had already done what you told me to do, before i even got the message. I've been working with references for a while now. Lol Im just having trouble drawing the camera on screen. I dont know where to put it in the Game1 class. And also i dont have the "BlendState" like it doesnt even pop up or even exist. And also, im using XNA 3.1 not 4.0. im using this version because of my class. If you know of any other way to draw it please tell me. Thanks!

  • @Armadillopants92 Okay you're right, there is no BlendState is 3.1

    I'll do a bit of research and message you if I find out.

  • @oyyou91 okay thank you very much, its just been pissing me off haha ive tried looking on google but i havent found too much that really helps. Ill send u my draw code if u want me too

  • @Armadillopants92 Yeah I'll have a look at that.

  • Comment removed

  • @kstdahora I actually have no idea what you're talking about. I'm sorry.

  • In the update method of Camera, i not send Game1, my object is "nav"...that have the follow code:

    public void update(GameTime gameTime, Nav nav) { centre = new Vector2(nav.Position.X + (nav.Texture.Width / 2) -400, 0); transform = Matrix.CreateScale(new Vector3(1, 1, 0)) * Matrix.CreateTranslation(new Vector3(-centre.X, -centre.Y, 0)); }

    it's ok yeah?

  • My back ground image are not moving;;;; the code is the same :/

  • @kstdahora I couldn't say why without seeing your code.

  • This came right on time! I'm working on a school project and hadn't a clue how to make this work! Great job!

  • GOOD JOB!

    

  • ooooo man you mean i have to wait like forever for more of your great tutorials??? ;(

    great tutorial by the way, helped me out alot. i look forward to seeing more vids from you.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more