Jump to content

2D Launch Example


 Share

Recommended Posts

A little something I just whipped up.

Posted Image

+ What is a 2D Launcher?

It's a program I made that calculates and visually launches an image into the 'air' , accounting for the object's initial force, initial altitude, mass, and the initial force's angle - and, of course, gravity.

+ If you're not into math, then you can enjoy this a little by just punching in values to see the object arc or free-fall within the window.

(note: the object is not FORCED to stay inside the window - that is up to the user's values; However, if it goes outside the window, the window will be moved to show the continuation of the object.)

+ How does it do it?

I use some general functions used in calculating falling objects and object launching in the included Phys.au3 to calculate all of the needed values.

+ Why bother?

The 2D launcher just makes an example of the functions used in Phys.au3, which might be useful to new (or old?) programmers looking towards using these types of equations.

NOTES:

-Also, the object isn't supposed to continually accelerate just because the image of a rocket is used - the initial velocity is determined by the "Force" value entered.

UPDATES:

Example.au3 now uses GDIPlus to draw the rocket image.

ZIP Attached - Contents:

example.au3 - the 2D Launcher example script.

Phys.au3 - the required physics function library

r_90.jpg - small rocket image for pointing straight up

PhysExample.zip

5-5-13 Edit: Fixed posted images

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

nice work mate ;D

---------------------------------------------------------------------------------------------------------------->>>>>>| |My scripts: |Warcraft lll auto login -- an auto login to warcraft lll ;) |Wow auto login -- an auto login to wow ;) | |---------------------------------------------------------------------------------------------------------------->>>>>>|

Link to comment
Share on other sites

A little something I just whipped up.

Updated the ZIP with newer versions of Phys.au3 and example.au3

Changes in Phys.au3:

I found some faster ways to rewrite parts of Phys.au3 and fixed some bugs concerning large Force values paired with angles over 180 that resulted in the wrong "X max" values - this issue has been resolved.

Changes in the example script:

"X Max" is now, more correctly, labeled "X End" now (as it's the X-Intercept that the program stops on.)

I have also add a "G-Force" input which allows you to multiply a number against the acceleration from gravity.

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Pretty cool!

Although I found a minor bug: if you abort the launch, the rocket ship ends up in the final position. If you abort the launch, the ship should go back to the start, or better yet, drop straight down from wherever it is in the air. :)

Link to comment
Share on other sites

Pretty cool!

Although I found a minor bug

not really a bug - I chose to display the last position because it was more efficient to script and was possibly the most important point along the arc. (with exception to highest point (X End/2, Y Max) and the starting point (0,0))

However, since I added the "X End" and "Y Max" outputs (you can deduce the landing point from (X End,0)), I probably could update to just make the rocket explode in mid-air.

EDIT:

Updated the script

- The rocket now explodes in mid-air when aborted.

- Added two checkboxes to toggle if X or Y movement is shown visually

(Note: if you uncheck both X and Y, you'll basically be camera-locked to the rocket - you'll see it turn, but not move)

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

  • 2 months later...

And in the next update use GDI+ to rotate the Rocket correctly :P looks better then :P

You just got your wish, the example now uses GDIPlus.

It flashes a sometimes but not alot here, I tried to cut down on some of it.

if there are any issues with this new edit, let me know.

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

:P nice!

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...