Positioning moving objects

I'm getting ready to make a 2d game and wasn't sure how to draw moving objects on the screen. I've played around in the past and always had a fixed sized window and basically moved objects around on a pixel grid. I want to have a resizeable window but keep the relative size and movements of objects the same. How is this usually done? Should I just render it to the largest possible window size and then transform it to the appropriate size? Thanks in advance!

jgould wrote:
I'm getting ready to make a 2d game and wasn't sure how to draw moving objects on the screen. I've played around in the past and always had a fixed sized window and basically moved objects around on a pixel grid. I want to have a resizeable window but keep the relative size and movements of objects the same. How is this usually done? Should I just render it to the largest possible window size and then transform it to the appropriate size? Thanks in advance!Not sure what that means. Basically you have a couple options:
1- Store locations by ratios, not exact coordinates. So if you want a GameObject's location to be in the direct middle of the screen, its position would be (.5, .5). Then when you go to draw that GameObject, you have to convert that position to screen coordinates. You do this simply by multiplying the ratio-coordinates by the game window's width or height.
2- Store locations by some model coordinates. This is similar to the first method, but requires some extra translation. You would store the GameObject's location via coordinates such as (50, 50), but you would also have to keep track of how large your game window model was (for simplicity's sake, let's say it is 200 by 100):
drawPoint( (gameObject.getX() / 200) * gamePanel.getWidth(), (gameObject.getY() / 100) * gamePanel.getHeight() );Does that make any more sense?
Edit- I should say that there probably are a ton of other ways to do it, these are just the ways that most easily fit into my head. It's all just algebra though.
Edited by: kevinaworkman on Nov 13, 2009 2:54 PM

Similar Messages

  • Make positive vertical position change = UP when moving object? CS6

    When moving an object, entering a positive value for vertical position sends objects DOWN. How do I reverse this such that entering a positive value will move objects UP?Thanks.

    What about the suggestion in the first post in this thread, Reasoner?
    http://forums.adobe.com/message/3859580#3859580?tstart=30#3859580
    It is more work than using a script (was linked to in post #4 in the other thread).
    We may have to ask Carlos to make a new script that works in CS6 (and in CS7 and CS8 and so on).
    Carlos, what say you?

  • Exact, precise positioning of Objects

    I have an application that needs to be very precise in the positioning of a text object (so that OCR can read it).  As an example, I can position an object at x=3.5 inches but I need to position at x=3.53.   I use the "Size and Position" dialog box and enter x=3.53.  Get out of the dialog, go back in and it has changed to 3.52, Get out and in and now it is 3.51.  Once at 3.5 it stays at 3.5.  Position seems to work well at 1/10 of an inch but I need 1/100 of an inch.  Snap to Grid & Free-Form Placement Options can be on or off - no difference.
    This is my first post.

    James Terry You sent a reply via email with discussion regarding setting the grid to 0.01 inches (which is 1/100 of an inch).  When I sent grid to 0.01" and moved them manually without using "Size and Position" dialog window, the objects stayed where they needed.  Going in and out "Size & Position" does cause it to move.  But by forcing 0.01" with snap turned on, I GOT WHAT I NEEDED!  James: put in a response and then I can award points and mark this answered.

  • Blur moving object in AE CS6

    Hi:
    I need to blur a moving object:
    - The effect is only needed at some point of the video, it must appear, and then disappear, not being on screen the whole time.
    - The object is moving, and changing shape, the blur must adapt to it.
    - I've been trying to use the "Track Motion" option with Position & Rotation, then the "Analyze Forward" button, but the thing makes a mess all over, it's not following the object at all, then if You try to adjust it manually, it's only done in 1 frame, in the other frames the thing is off the object, then the "Tracking" stays on screen.
    Thanks in advance.

    Are you saying that you have something in some video that you have shot that you want blurred out? If so, you could create an adjustment layer with a mask on it over the object you want to blur and then just animate the mask over time. Now, you could use motion tracking to help that mask follow the object, but it sounds like you are having trouble with getting it to work properly. Try the tips here for doing motion tracking correctly. Alternatively, you could follow the tips on rotoscoping to make the mask animation go more quickly. Also, if you have After Effects version 12 (also known as AE CC), you can use the new mask tracker feature.

  • Trouble selecting and moving objects near text in Adobe Illustrator? Try this.

    It's been 4 years since I left Corel DRAW for Adobe Illustrator. One thing I could never get used to is the crazy way text has an impenetrable invisible sheet over it making it hard to select objects near or behind it.
    With Corel DRAW I was used to be able to select text by simply clicking on the visible area of the text. Selecting stuff behind the text by clicking between letters or right next to a decender was never a problem. But Illustrator is a different story.
    Tonight I finally found a way to make selecting text in Illustrator behave more like Corel DRAW.
    I wrote it up here: http://www.johnstanowski.com/blog/trouble-selecting-and-moving-objects-near-text-in-adobe- illustrator-try-this/
    Just thought I'd share! 

    It's not spam, but thanks for assuming.
    I was up really late writing that blog post. Posting a link was the quickest way to share and be able to go to bed.
    Plus it's rather lengthy. I thought that would be rude to use an Adobe forum for my articles.
    If you saw my blog you will have seen there's not much going on there at all, and no calls to action to hire me. I don't have anything to gain by getting traffic.
    And, yeah, layers work for selecting, but that slows you down. Who would want to look away from their work to find and select a layer when they're trying to tweak positions of objects? Layers suck for selecting quickly.
    And there must be something wrong with me but I find using Type Object Selection by Path Only by itself hard to use. I'd really just like to click on the text itself rather than an invisible hairline you have to probe to find.
    Here's the post. I hope people who had trouble like me find it helpful.
    Do you have trouble selecting objects near Point Type in Adobe Illustrator? You’ve been there. You want to select an object. Problem is, it’s really close to piece of Point Type. All too often we try to select objects that wind up being unreachable because they lie too close to a piece of Point Type, which we wind up selecting instead. Luckily, after years of angst, I discovered a solution.
    Point Type in Adobe Illustrator is funny. There’s this invisible “shield” around it. This shield is much larger (at least it seems that way) than the text itself. It prevents you from selecting objects behind text by clicking between letter and words. This shield is particularly meddlesome with lowercase letters and decenders because we think surely we can click on that blue box (or whatever) because it seems far enough away from that Point Type. But the lowercase “g” in the Point Type’s territory.
    Okay, now that we know we’re talking about the same thing, let’s move on to the solutions.
    Step 1. Check ‘Type Object Selection by Path Only’ in Preferences
    You’ll find this option in Preferences/Type. Click it and that nasty text shield goes away. But there’s a price to pay. With this option activated, the only way you can select your text is by clicking on the text path, a super, tiny, thin baseline thingy under all the letters, but above decenders. It’s really hard to grab. To do it right you need to slowly approach the text path with your cursor. When you’re right over it, Illustrator will let you know by adding a small black square to your cursor. Now, you can click, hold and move your text. But this workflow can really slow you down and break your rhythm, maybe even more so with it turned off.
    Step 2. Add the ‘Outline Object’ Effect
    Select your Point Type and, from under the Effects Menu/Path/, select Outline Object. This effect does something really sweet to text in Illustrator: it lets your Point Type objects be treated as if their were converted to Outlines. You can still edit the text, but as far as selecting it, Illustrator now considers it outlines and shapes instead of a text object. Basically, it now considers the Path of the text to be the text itself! Now, since we’ve already checked ‘Type Object Selection by Path Only’ we can now click on the text to select it. Just the text. Not the baseline, not the wacky invisible shield surrounding it.
    And now… you can select things behind the text by clicking between words and letters. And the ONLY way to select Point Type is to click on the visible parts of the text itself! Problem solved.
    Potential Problem:
    Too much of a good thing could be a bad thing. Let’s say you have some Point Type set in a very light face and it’s pretty small or you’re zoomed way out. Selecting that text could be a problem since you have to actually click on the text itself. Actually it isn’t that hard, it may just require an extra click to grab it. If you have a set of smaller, light-faced bits of text, you can elect to just not apply the Outline Object effect to these. They’ll get their ‘shield’ back and be easier to click on. And since they’re so small, they don’t pose a problem with selecting things behind them anyway.
    Applying this technique to your old files
    Now that you’ve learned this awesome new way to work around type in Illustrator, you may be anxious to open yesterday’s project and get back to work. But you may be not be looking forward to applying the Outline Object effect to each and every piece of type. For this you can use Illustrator’s “Select Same” feature. Select one piece of text. Then from the Select Menu click on Object/Text Objects. Now ALL of your text objects will be selected, and you can apply the Outline Object effect to all of them at once!
    That’s it. If you build ads or work with a lot of type in Illustrator, you’re about to be able to work a lot faster… and happier.

  • Poor Capture on moving objects

    I know similar questons like this were asked before, with the results blamed on the camera, but here is my problem: I have a fixed position camera and need to capture a still image with a small moving object (about 10-15mph). When I do a capture, the moving object in the image is unclear (not blurry, more like odd and even fields aren't sync'd). I know it's not the camera, because I have a digital taped copy from that camera, and it's clean when I pause the tape. I'm using a 1411 board on a p4 system. I have included two images - the first image is from a live capture, the second is the digital tape paused and then captured (to show that the camera is not at fault). The moving object in the image is a dog jumping into the water at
    about the 13 foot mark on the back of the dock.
    Thank you,
    -Dave
    Attachments:
    bigairdog.jpg ‏24 KB
    bigairdog2.jpg ‏23 KB

    Dave,
    Actually, it is the camera. The odd and even fields are taken at different times, so they don't match up. To do this properly, you need to use a non-interlaced camera.
    The reason the pause looks good is because the camera is cheating just a little bit. To eliminate the blur, it only uses the lines from the odd frame, and interpolates to create the even lines. I can duplicate the process on your live image using Corel PhotoPaint, and I get an image that looks just like your paused image. If you look closely at the paused image, you notice that some things look a little blockier and blurrier than the live image.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • Is there a "blur moving object" feature in Premiere Pro 2, like for pixelating a moving face?

    Is there a "blur moving object" feature in Premiere Pro 2, like for pixelating a moving face?
    When I went to post this question, I put "blur" in the tags, and it offered me a list of tags with the word "blur", including "path blur", which sounds like what I'm looking for, but I a did a search in the PDF manual for Premiere Pro 2, and it didn't find that anywhere.
    Thanks,
    digi

    There is no path option in PP2
    If the subject is moving you need to keyframe position over time yourself.
    Premiere - Blur Face - YouTube

  • DaNI following a moving object using it's ultrasonic sensor

    Hi,
    I was wondering if anyone would be able to point me in the right direction/ help me out.
    Is it possible to program daNI to follow a moving object throught the use of it's ultrasonic sensor?
    I ask as i aim to (hopefully) create a platoon of daNI using this program.
    So far I've seen an awesome example of a daNI platoon from the UCLA Mechanical Eng. department, found here:
    http://zone.ni.com/devzone/cda/tut/p/id/12902
    If i read correctly, UCLA used an infrared sensor to get the daNI to follow each other.
    My project aims to have a lead daNI that follows a specified path (or even just a straight line) and the following daNI will use the program I'm requesting further info for.
    Regardless, if anyone could share any knowledge, links, or example code to kick me in the right direction, I would be very thankful.
    Many Thanks,
    Mike ^^,

    Hello,
    I think the examples in that link are using the ultrasonic sensor, you can see the little sensor moving left to right on top and they have placed a sheet of paper to get a good 'bounce'.
    Getting a daNI to follow in a straight line should be fairly straightforward as you can get a distance and use that as feedback for your motors. I think using daNI's onboard sensor to follow a curved path would be quite difficult. In the linked video you can see that the robots are quite slow as they have to perform an entire sweep of their sensor before they can act. Traditional following systems use 2 sensors placed a distance apart from which you can measure the intensity of a sent signal and therefore calculate a rough position.
    In terms of material, the courseware is pretty good for getting you started with daNI:
    http://zone.ni.com/devzone/cda/epd/p/id/6491
    Otherwise a browse of the Robotics community is a great place to go:
    https://decibel.ni.com/content/community/zone/labviewrobotics
    (this might be of some interest: https://decibel.ni.com/content/docs/DOC-18154)
    Hope this helps.
    Nick C.
    Cardiff University

  • Nstimer Score system affecting moving objects.

    Okay so, ive quickly made this code to clone what is happening with my other app! so What happens is when the view is loaded, there is a count up function (this in my game is a scoring system) . But everytime it counts up by 1 the NStimer controlling the moving object - denoted as "moving" moves for 1 second but then goes back to its original position and repeats this process until the app in terminated.... I have no idea why this happens! It worked fine in xcode 5. But by running it on xcode 6, it doesnt work.
    -(void)counter{
        NSLog(@"1");
        count =  count + 1;
        _label.text = [NSString stringWithFormat:@"%i", count];
    -(void)move{
         NSLog(@"why am i repeating");
        _block.center = CGPointMake(_block.center.x , _block.center.y+ 5  );
        if (_block.center.y>400) {
            _block.center = CGPointMake(160 , _block.center.y );
    - (void)viewDidLoad {
        timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(counter) userInfo:nil repeats:YES];
         moving = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(move) userInfo:nil repeats:YES];
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.

    nope viewdidload is never called , but the code isnt too difficult to replicate. Id be glad to post it up somewhere, but i dont know how to post it to github!
    but to clone the code,
    in the .h file we have:
    int count;
    @interface ViewController : UIViewController
        NSTimer*timer;
        NSTimer*moving;
    @property (strong, nonatomic) IBOutlet UILabel *label;
    @property (strong, nonatomic) IBOutlet UIImageView *block;
    and .m file
    -(void)counter{
        NSLog(@"1");
        count =  count + 1;
        _label.text = [NSString stringWithFormat:@"%3.2i", count];
    -(void)move{
         NSLog(@"why am i going bak to the start");
        _block.center = CGPointMake(_block.center.x , _block.center.y+3  );
    - (void)viewDidLoad {
        timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(counter) userInfo:nil repeats:YES];
         moving = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(move) userInfo:nil repeats:YES];
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    It must be something with the new xcode... because it worked perfectly in xcode 5, perhaps it might be a thread problem? i duno , really want to solve this issue

  • Interlace problems with moving objects using iDVD

    I had an MP4 file (created by a 3rd party) from a Hi-8 analog tape which has some interlace artifacts on moving images (left image of boy) but not too bad. When the MP4 files was imported into iMovie 11 the interlace artifacts smoothed somewhat - that was OK (right image of boy). The camera was still and the boy was moving.  Vertical lines on stationary objects are OK in all images. These are screen captures from the Mac of the mp4 played through quicktime and the same file imported into iMovie 11 and played.  I paused both to take the screen capture.
    The completed project in iMovie 11 looked OK when previewed prior to rendering. These are 20 year old videos so my expections were being met.   I rendered the project with iDVD to the hard drive first and then to a DVD with the same poor imaging result on the moving object.  I am using a new Macbook Pro I bought in early January which came with iMovie 11 and iDVD  Ver 7.1.2 (1158). Running Mac OS X 10.7.3  Macbook Pro  2.3 Ghz Corei7   8GB 1333 Mhz DDR3.
    I couldn't screen capture from the MAC DVD player screen to illustrate the poor result (got a checkerboard screen) so I took a photo of the screen and imported that (below).  The moving boy on the left is from an  iMovie 11 screen capture, the image on the right is the moving boy from the rendered DVD I paused on the Mac (and took a pic of).
    Below a close up of the poorly rendered moving boy viewed on the resultant DVD.  This translates into a horrible rendition of any quick moving object.  It happens with any moving image - i.e. a pan across a room with straight vertical lines like edges of a wall will show as serrated and poorly rendered edge. I used a trial version of the Daniusoft DVD creator with the same result!  I am at a loss on how to resolve this issue.  Any thoughts out there??
    I had previously used Pinnacle Studios on my old XP PC which worked great on other tape's Mpeg files and created great DVD's (never had an interlace problem) ... until my computer died .....  so I figured Apple and associated software should be at least equal if not a superior product.   Now I'm not too sure!

    I had an MP4 file (created by a 3rd party) from a Hi-8 analog tape which has some interlace artifacts on moving images (left image of boy) but not too bad. When the MP4 files was imported into iMovie 11 the interlace artifacts smoothed somewhat - that was OK (right image of boy). The camera was still and the boy was moving.  Vertical lines on stationary objects are OK in all images. These are screen captures from the Mac of the mp4 played through quicktime and the same file imported into iMovie 11 and played.  I paused both to take the screen capture.
    The completed project in iMovie 11 looked OK when previewed prior to rendering. These are 20 year old videos so my expections were being met.   I rendered the project with iDVD to the hard drive first and then to a DVD with the same poor imaging result on the moving object.  I am using a new Macbook Pro I bought in early January which came with iMovie 11 and iDVD  Ver 7.1.2 (1158). Running Mac OS X 10.7.3  Macbook Pro  2.3 Ghz Corei7   8GB 1333 Mhz DDR3.
    I couldn't screen capture from the MAC DVD player screen to illustrate the poor result (got a checkerboard screen) so I took a photo of the screen and imported that (below).  The moving boy on the left is from an  iMovie 11 screen capture, the image on the right is the moving boy from the rendered DVD I paused on the Mac (and took a pic of).
    Below a close up of the poorly rendered moving boy viewed on the resultant DVD.  This translates into a horrible rendition of any quick moving object.  It happens with any moving image - i.e. a pan across a room with straight vertical lines like edges of a wall will show as serrated and poorly rendered edge. I used a trial version of the Daniusoft DVD creator with the same result!  I am at a loss on how to resolve this issue.  Any thoughts out there??
    I had previously used Pinnacle Studios on my old XP PC which worked great on other tape's Mpeg files and created great DVD's (never had an interlace problem) ... until my computer died .....  so I figured Apple and associated software should be at least equal if not a superior product.   Now I'm not too sure!

  • How do I pull up the left control panel that allows you to move from text to moving objects on page?

    How do I pull up the left control panel that allows you to move from text to moving objects on page?

    Do you mean this one:
    If so, go to the Window menu and make sure that Tools is checked.

  • Dynamic Positioning of Objects in a Grid (rows and columns) AS3 Tutorial

    The topic of a dynamic positioning of objects in a right grid (rows and columns) comes up often so I decided to post an AS3 solution here:
    http://flashascript.wordpress.com/2010/12/25/arranging-objects-into-2d-dynamic-grid-with-a ctionscript-3/

    Hard to tell from your description but this might help:
    http://dtptools.com/product.asp?id=atid
    Bob

  • Dynamic Positioning of Objects in a Grid (rows and columns) with AS3 Tutorial

    The topic of a dynamic positioning of objects in a right grid (rows and columns) comes up often so I decided to post an AS3 solution here:
    http://flashascript.wordpress.com/2010/12/25/arranging-objects-into-2d-dynamic-grid-with-a ctionscript-3/

    Hard to tell from your description but this might help:
    http://dtptools.com/product.asp?id=atid
    Bob

  • How do you filter out moving objects in a movie?

    Hello!
    I'v searched the internet for solutions to this but I cann't find any.
    Im prittie new and I need to make a house on fire while two guys (one is me)
    will be walking away from it, towards the camera.
    I want to filter out these two guys and only apply fire and flames to the house itself!
    To do this I used Time Diffrence and tried to isolate the guy using Fast Blur and Luma Key
    but Im prittie lost.. Nothing works and I really need guidence
    Do you know a trick to use?
    I cant do greenscreening as the green background would cost a fortune..
    But isn't there anyway to filter out moving objects?

    I'm not sure that you totally get the process. This kind of shot requires at least 3 elements or plates. These three plates become three layers in After Effects. The bottom layer would be the Background Plate which is a shot of the house without any actors in the shot. The next plate would be the Effect Plate or Fire Plate which could be any shot you can get or generate through plug-ins of flames. The top layer would be your Foreground Plate or your two actors.
    Now that you know what you need you can plan your shoot. The background plate is easy. Just set the camera on a tripod and lock it off. NO zooming. No panning, No change of focus. The foreground plate is also easy. You don't have to green screen the entire set, all you need to do is to put a green screen behind your actors. I do this kind of thing all the time using a 6' X 6' (sometimes smaller) green screen (or blue or red or purple) made of fabric and stretched over a frame that I made from 1/2" EMT electrical conduit and 4 90º elbow connectors for less than $20 at Home Depot or Lowes. You get a couple of assistants to walk behind your actors holding the green screen behind them. If you need to include their feet they can be easily rotoscoped out later and you can garbage matte everything else. If it's impossible to green screen the shot then you are stuck with roto, but that's much easier in CS5 using the roto brush. If you use your show with the actors as the background plate roto is even easier because you can hide a multitude of sins by simply feathering the roto and letting the fire light wrap around the actors a bit.
    The fire plate can be purchased footage, or you could shoot a real fire against a black background, or you could create the flames using AE or even a 3D app like Blender (free) or a bunch of other apps.
    Making the shot look real requires a few tricks once you have your clean plates. Fire creates light so you've got to add lighting effects to the background plate to sell the fire. You've also got to wrap light around your actors. Look for tutorials on light wrap for this. You can really help sell the effect if you place some flickering light sources behind and to the side of your actors when you shoot the foreground (actors) plate.
    Once you get a handle on these techniques it's fairly easy to make the transition to pulling of this kind of a shot with a hand held camera (now you have to learn motion tracking). On a project I recently completed we had to put a fire in a prop fireplace while actors moved around bringing milk and cookies for Santa. It was all roto and the fire was shot at night with nothing more than a black cloth (Duvetyne) behind the fireplace grate. The final composite was 10 layers and was so totally believable that no one questions the shot.
    The layers were from top to bottom, reflection in grandmas glasses, light wrap, actors (roto of original background plate), fire flicker layer, color mask layer (more orange around fire, fire glow layer, fire layer in Add mode, second fire layer in screen mode, third fire layer Luma keyed, and finally the original plate which contained all the actors, carefully lit with flickering firelight simulated by dangling a stick with fabric cut into 1/2 inch wide strips about one foot long in front of a orange gelled light behind and to the right of  the actors.
    If I get a chance I'll post a screenshot.
    Here you go:
    Light Wrap:
    The Movie
    Part of the original render before color grading.
    Enjoy

  • Lines on moving objects

    When I export DV clips from FCE I get lines appear on moving objects, (HDTV). When I export the same clip using iMovie08 it all looks smooth.
    I've tried the de-interlace, it made it worse.
    How can I get rid of the lines in FCE?

    shuggyboy1 wrote:
    ... What is the _best setting to export_ from imovie HD 6 to idvd to prevent this yet still maintain DV quality?
    .. not to export at all, that simple..
    the zillions of Export options could cause trouble.
    simply, store your iM projects in the 'Movies' folder of your Mac ...
    iDVD will 'find' them automatically and cares for itself to import..
    Plan B)
    drag'n drop the whole project from Finder to iDVD.. again: no export involved, no trouble..

Maybe you are looking for