Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Making a game using matlab.

  1. Apr 11, 2012 #1
    i am doing a project from my introductory CS course. i am to make game available online by the name of air transporter. (if possible do check it out online before giving me any ideasa. http://www.physicsgames.net/game/Air_Transporter.html) frankly speaking i do not know all the ropes of matlab. i just want to ask that how should i get started. what functions should i make first? and an important one: i used to move a rectangle using the mouse user input during my labs. but how am i supposed to move a helicopter. i mean should i first introduce an animated image using the 'image' command, assign it a handle and then set it the same way or is there any other suitable method.
    thanks for any help.
     
  2. jcsd
  3. Apr 11, 2012 #2

    Pythagorean

    User Avatar
    Gold Member

  4. Apr 11, 2012 #3

    jedishrfu

    Staff: Mentor

    id do an OO design where I identify the objects of the game. In this case you have a helicopter and some objects on the ground and some scenery.

    then do a top-down outline:
    1) initialize game variables (read previous state if any)
    2) while loop to:
    2.1) read keyboard characters
    2.2) dispatch based on keyboard char to routine
    3) end of game closeout (save state...)

    then make a routine to handle each keyboard command

    then make lower level routines to:
    - draw an object anywhere you want it. The object could be an image that you place on your graphical canvas.
    - read the keyboard and return a command code
    - ...


    MATLAB is really good at data manipulation and data analysis but not so good as a general purpose language
    and so ou have not get the performance you want in your game.

    Also, you do need to look at a couple of things in MATLAB before proceeding:
    1) is there a function to return a single character from the keyboard that doesn't block until the RETURN key is typed.
    2) Can you get a canvas and draw on it (ie does it have drawing functions )
     
    Last edited: Apr 11, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Making a game using matlab.
Loading...