Working With IntersectsWith And Angles?

Mar 9, 2011

I followed this tutorial [URL] in creating a pong game in VB NET, everything worked well as followed but believe there is still more development that needs to be done to it, for example if the ball is moving horizontally in a straight line, it will just re-bound of the paddles in the same angle everytime which means there is no point to the game. When the game starts moving the ball at a random angle and the ball re-bounds of either paddles, it will re-bound in the same angle it started with each time.

Pointed out what code this is:

Dim random As New Random() ' Random instance
Dim xVel As Single = Math.Cos(random.Next(6, 8)) * speed ' Move ball from randomized angle in X-axis
Dim yVel As Single = Math.Sin(random.Next(6, 8)) * speed ' Move ball from randomized angle in Y-axis

[code]....

If the ball hits the top of the paddle object, it should re-bound at a different angle How it should be is when the ball hits the paddle object, it should re-bound at a different angle, if it intersects at the top of the paddle, it should re-bound up or bottom of paddler should re-bound down.

View 4 Replies


ADVERTISEMENT

Game Programming :: Rectangle.intersectswith Doesn't Work?

Jul 23, 2008

I'm trying to find out when the ball strikes the paddle. So what I did was made two rectangles, one around the ball and one around the paddle.

[Code]...

The problem is, the ball goes right through the paddle!!!! Shouldn't the ball deflect off the paddle and move in a new direction depending on angle? Why does the ball go right through the paddle?

View 4 Replies

Way To Do Collisions From All Angles

Aug 19, 2009

Well I attempted collision detection and it was only ok. First of all only the out of bounds place would work because I just made the right side of the screen make you go left etc.My moving button also goes outside of the area for a brief second before it teleports back to the bounds + 3 or w/e.Never mind all of that I guess.Could someone give me some source code for the simplest way to do collisions from all angles (like a zelda game or something...) or just up/down or left/right (like in pong).

View 1 Replies

Calculate Angles Of A Triangle?

Nov 9, 2009

How can i calculate the angles of a triangle, where i have the lengths in cm of all 3 sides?

heres an example where i already know the angles. i know its a sin, cos or tan formula, but nothing i've tried works.

View 14 Replies

VS 2010 Lines From Angles

Jan 19, 2012

I have got the code to draw the line at the angle. the issue is that I need 0 degrees to be the right hand side and not the top.[code]

View 37 Replies

C# - Bug In The Matrix.RotateAt Method For Certain Angles?

May 24, 2010

Here's the code i'm using to rotate:

Dim m As New System.Drawing.Drawing2D.Matrix
Dim size = image.Size
m.RotateAt(degreeAngle, New PointF(CSng(size.Width / 2), CSng(size.Height / 2)))
Dim temp As New Bitmap(600, 600, Imaging.PixelFormat.Format32bppPArgb)
Dim g As Graphics = Graphics.FromImage(temp)
g.Transform = m
g.DrawImage(image, 0, 0)

(1) Disposals removed for brevity.

(2) I test the code with a 200 x 200 rectangle.

(3) Size 600,600 it just an arbitrary large value that I know will fit the right and bottom sides of the rotated image for testing purposes.

(4) I know, with this code, the top and left edges will be clipped because I'm not transforming the orgin after the rotate.

The problem only occurs at certain angles:

(1) At 90, the right hand edge disappears completely.
(2) At 180, the right and bottom edges are there, but very faded.
(3) At 270, the bottom edge disappears completely.

Is this a known bug?If I manually rotate the corners an draw the image by specifying an output rectangle, I don't get the same problem - though it is slightly slower than using RotateAt.

View 1 Replies

How To Calculate Angles Of Right Triangle Given Lengths

Apr 5, 2011

I'm working on a Pythagorean Theorem program that calculates the sides and angles of a right triangle. I have the side measurements and all that down, but I can't find the Visual Basic function that will allow me to calculate the angles from the side measurements. I've tried asin and sinh, but both give me the wrong measure.

View 2 Replies

How To Find Angles Of LineShape Controls

May 9, 2012

I need a Function or section of code that finds the angle of a lineShape. Alternitively, a code to find the angle between two set coordinates would also work. I need to know the angle in order for my program to work properly. I'm using VB Express 2010.

View 2 Replies

VS 2008 Recognizing The Pixel Angles?

Aug 20, 2010

Im making a little game. All it does is make a bunch of Random Letters. Move around the screen. Im drawing to the form with paint. But i wanted to make it. So you have to click the letter that my program ask's you to click. I know there is easy ways of doing this. Like just getting the x,y and the mouse x,y on the click event. But i was wondering. If i could accomplish this task. Just by Scanning about 10x10 pixels from where the mouse down event is triggerd. to see if a letter is there. And how i could make it see if it is an A or B etc. The font is white. And about this size. I was thinking about it counting all the white pixel's but that wouldn't work?

View 3 Replies

Change Pictureboxes X2 Y2 To Tilt Some Degrees Other Than 90 Degree Angles?

Jan 15, 2011

I dont even know if you can do this in vb.net but, how do you change the pictureboxes x2 y2 to tilt some degrees other than 90 degree angles?

View 2 Replies

UnhandledExceptionEventHandler Samples From Msdn Working, In My Code Not Working?

Sep 3, 2009

I found on msdn samples and modified (add Thread.GetDomaind.UnhandledException)

<SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.ControlAppDomain)> _
Public Sub Main()
' Add the event handler for handling UI thread exceptions to the event.[code].....

View 1 Replies

VS 2008 Cannot Seem To Get A Working Filter In Working Order

Jun 18, 2009

It appears that my favorite thing in the world is tackling projects that are beyond my current knowledge and abilities. I have a little project that I am working on which is a simple image viewer stocked with (upon completion) your standard Load..., Next/Previous, Zoom In/Out, Actual Size, and Full Screen capabilities. However, I am running into a few snags:

(1) I've been able to get my "Load..." button to display a file dialog box, but I cannot seem to get a working filter (with which only image file types are allowed to be selected) in working order.

(2) I have a PictureBox object (entitled PictureBox1) that displays the image selected via the file dialog box, but it loads images in their full size (1:1/100% zoomed) state without scrollbars, etc. to allow me to navigate the loaded image. I would like to have it load the image, initially, to fit within the dimensions of PictureBox1 and from there be able to zoom in/out via my "Zoom In/Out" and "Actual Size" buttons and be able to scroll if the zoom level is beyond the dimensions of PictureBox1.

(3) It dawned on me that I haven't the faintest idea how to get my "Next/Previous" buttons to allow the user (me) to navigate, in succession, the images contained in the folder in which the currently loaded image is stored. [code]

If it is deemed that this thread is inappropriately requesting help, I ask that it be locked/deleted quickly as I recognize that this is a large community with many discussions going without need of unwelcome posts.

View 9 Replies

Make Application Working Better And Never Freeze / Make Application Working With Any Count For Loop Without Freeze

Jan 19, 2012

I'm using loop to read data from sql and then make some calculations then save it again to another table but when application loop for 3 or 4 times it's freeze but the job is done but if loop = 10 or more then it is freeze and hangup for long time .i need to learn how to make my application working better and never freeze and make application working with any count for loop without freeze .

View 7 Replies

For Each X As Y In Z Not Working?

Jul 14, 2010

I can't understand why this is not working.


[code]...

View 3 Replies

GDI Changes - Working With Vb.NET And GDI+

Mar 28, 2009

I am moving over to vb.NET and am experiencing the learning curve. Am learning quickly, but I do have a question for anyone who can respond. vb6 could be made to run much faster by going after the GDI API directly, rather than going through vb6's standard wrapped functions like Line(), and Circle(). Now that I am working with vb.NET and GDI+, as far as I can tell there is no wrapper anymore and you hit GDI+ directly "right out of the box". Is this true? It looks like trying to phenagle the old vb6 API code can't work because .NET does not use GDI anymore...it uses GDI+ via the System.Drawing namespace.

View 16 Replies

RTS Is Not Working With EXE

May 19, 2012

I'm developing application using RS485.

Which is working fine when i debug from project itself but when i run after building .exe it is not getting any reply back.

After some try and error i found that RTS(Request to Send) is the reason behind this problem.

Port.RtsEnable = True
Port.Write(DATA)
Port.RtsEnable = False

View 4 Replies

FileSystemWatcher Is Not Working?

Jul 31, 2010

I added FileSystemWatcher in Form1_Load like this -

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
....................

[code]....

View 2 Replies

.net - AddHandler Not Working?

Apr 26, 2010

I can't figure out why my addhandler is not firing?In the Sub "CreateTagStyle" the AddHandler is not firing when the LinkButton is clicked Is there some reason that addhandlers can't be added at certain points of the page lifecycle?

<%@ Page Title="" Language="VB" MasterPageFile="~/_Common/Admin.master" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

[code]....

View 1 Replies

.net - CustomValidator Not Working (asp.net)?

Oct 4, 2011

I am using the CustomValidator for the first time but it doesn't seem to be firing DateExpireRequired_ServerValidate and just runs the code in the Click action.Been bugging me for a couple hours now! can anyone see a problem with what im doing?The DropDownList in my code below is populated using Roles.GetAllRoles()

ASP.NET
<asp:Label ID="lUserRole" runat="server" AssociatedControlID="tUserRole">User Role:</asp:Label>
<asp:DropDownList ID="tUserRole" runat="server" CausesValidation="True">
</asp:DropDownList>

[code]....

View 2 Replies

.net - GetShortPathNameA Not Working In C#

Apr 6, 2010

I'm trying to get get the short filename from a long filename but I'm having problem in c# code. VB.Net code is:

Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

[Code]....

But I cant get the c# version work. Am I missing something or what is wrong?

View 3 Replies

.net - ParamArray Not Working With COM?

Jul 28, 2010

I have a Class Library that is exposed to COM like this:

<ComClass(SomeClass.ClassId, SomeClass.InterfaceId, SomeClass.EventsId)>
Public Class SomeClass
Public Const ClassId As String = "GUID1"
Public Const InterfaceId As String = "GUID2"

[Code]....

Compile error:

Function or interface marked as restricted, or the function uses an Automation type not suppport in Visual Basic.

What do I need to do to properly expose this Method so I can use it like this?:

SomeClass.SomeMethod 1, 2, 3

View 1 Replies

.net - SQL Command Not Working?

Sep 29, 2011

I have an SQL command I am attempting to execute.The syntax is as follows

[Code]...

View 1 Replies

.net - ZipForge Not Working?

Mar 25, 2012

I'm using the ZipForge to extract an archive in VB.NET.When I run the code I get no errors, but it doesn't extract any of the files. This is the code I'm using:

ZipForge1.FileName = "Archive.zip"
ZipForge1.OpenArchive(FileMode.Open)
ZipForge1.BaseDir = "C:Extract"
ZipForge1.ExtractFiles()

View 1 Replies

.net Substring Not Working?

Oct 8, 2010

I'm getting an ArgumentOutOfRange error when using substring function in .NET. I'm new to .NET so probably doing something wrong. I have a txtField, which is a text field component in GUI. I'm using Microsoft Visual Basic 2010 Express

txtField.Substring(txtField.Length-4,txtField.Length-1)

If txt.Field contains only numberic values it works ok, but as soon as the text field contains characters it breaks.

View 1 Replies

Activex Com .dll Not Working Under Ie8

Nov 19, 2009

I have a COM dll that has been developed under vb.net. The Control works just fine in IE 6 and IE 7, but when IE 8 tries to load the control, the browser crashes. I look at the event viewer and I get an error 1000 about iexplorer.exe and mshtml.dll. Do I have to build this com dll with IE 8 on my development machine? How can I track down what is wrong with the Control?

View 2 Replies

Activex Not Working Ie8?

Sep 23, 2009

I created an activex in vb6 and used it asp.net. It work perfectly in ie6 . But not working in ie8 . No errors showing. In security setting I enabled activex option just like i changed in ie6. Only the small square i can see in ie8.

View 2 Replies

ADO To Read Dbf Not Working

Jul 27, 2009

According to all posts I have seen, this shold work, but of course it doesn't, does anyone see what is wrong....

DBF is on C: emp est.dbf
Dim DB As New ADODB.Connection
Dim RS As New ADODB.Recordset

[Code].....

View 9 Replies

API And Working Between Windows

Jul 8, 2009

Can someone please show me an example of how I would start a timer when viewing another window such as Mozilla Firefox? I would prefer it be started with a keystroke.

View 1 Replies

App Not Working On SOME XP Machines

Aug 19, 2011

I have developed an application is VS2010 ( VB app using .NET4 ) ... the application runs fine under Windows 7 and on (3) XP machines we have here. Had one user looking for support on an XP machine ... when he started the app nothing happened. No errors or anything, just nothing happened. Had him install the latest .NET4 framework and everything was fine.

Just had another support issue ... user with the same complaint ... had him install latest .NET4 ... but this time did not fix the issue ... still nothing happens when he clicks to start the app ... no errors ... just nothing happens.

I can't check this because it runs on all our XP machines .... Is the only criteria that .NET4 be installed? I created an install that includes only the EXE from the BINRELEASE folder ... nothing else. Do I need anything else. Strange that it works on all our XP machines.

View 15 Replies

App Not Working On Vista/7?

Jun 22, 2010

my application required the dropping of resources when a button is pressed.It seems when this button is pressed on XP everything works swimmingly, however...

on windows 7 and vista the button simply dosent do anything, ive tried elevating to admin etc..

Is it possibly due to how it creates/drops resources?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved