It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming C and C++ Forum

i have a serious problem, you can help easily

i have a serious problem, you can help easily

Postby regaljohnston on Wed Aug 26, 2009 11:35 am

I am in uni and i only have a short while to reprogram this ****ty application. if i fail then i will have wasted over £16000 on uni and will fail the course and woin't be able to go back to university ever again... please help!!!!!!!

1) I need to make the images move form left to right rather than right to left.

2) i need to add a set of radio buttons to my form so that instead of 4 random cars being added, you manually select cars instead.

if you need anything else please let me know, if you can help me please do... PLEASE!!!

basic description- [there are four cars that are selected at random by clicking the "btnSelectCars" which appear on the right side of the form. when you click the "btnStartRace" they race from right to left until one of them reaches the end and a label appears which just says winner or sumthing. i'll post the form inactive and the form active so you can view the pictures]

PLEASE IF YOU CAN HELP ME PLEASE HELP ME!!!!

here's the code. if you need anything else to help me please let me know asap!
---

Public Class frmWackyRaces

Private Sub btnSelectCars_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectCars.Click
For Each pct As PictureBox In pnlRaceTrack.Controls
Select Case Int(Rnd() * 11)
Case 0
pct.Image = My.Resources.ArkansasChugABug
Case 1
pct.Image = My.Resources.ArmySurplusSpecial
Case 2
pct.Image = My.Resources.BoulderMobile
Case 3
pct.Image = My.Resources.BulletProofBomb
Case 4
pct.Image = My.Resources.BuzzWagon
Case 5
pct.Image = My.Resources.Compact*****Cat
Case 6
pct.Image = My.Resources.ConvertACar
Case 7
pct.Image = My.Resources.CreepyCoupe
Case 8
pct.Image = My.Resources.CrimsonHayBailer
Case 9
pct.Image = My.Resources.MeanMachine
Case 10
pct.Image = My.Resources.TurboTerrific
End Select
Next
btnStartRace.Enabled = True
End Sub

Private Sub btnStartRace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartRace.Click
btnSelectCars.Enabled = False
tmrRace.Enabled = True
btnStartRace.Enabled = False
End Sub

Private Sub tmrRace_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrRace.Tick
For Each pct As PictureBox In pnlRaceTrack.Controls
pct.Left = pct.Left - Int(Rnd() * 30)
If pct.Left <= 0 Then
tmrRace.Enabled = False
btnReset.Enabled = True
lblWinner.Left = pct.Left + pct.Width
lblWinner.Top = pct.Top + pct.Height / 2
lblWinner.Visible = True
End If
Next
End Sub

Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
For Each pct As PictureBox In pnlRaceTrack.Controls
pct.Image = Nothing
pct.Left = pnlRaceTrack.Width - pct.Width
Next
btnSelectCars.Enabled = True
btnReset.Enabled = False
lblWinner.Visible = False
End Sub

Private Sub frmWackyRaces_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
End Sub
End Class
---
here are some images of the form i am working on-
http://i176.photobucket.com/albums/w...rminactive.jpg

http://i176.photobucket.com/albums/w...formactive.jpg
regaljohnston
 
Posts: 1
Joined: Wed Aug 26, 2009 11:33 am

Re: i have a serious problem, you can help easily

Postby instinct46 on Sun Nov 01, 2009 6:17 pm

I'm not sure what your programming in I get the feeling its cpp with visual studio or something of which I haven't a clue about, but when programming games in SDL for movement left to right theirs usually an x movement varible which depending on how far you want it to move is 1+

now if you want it to move right to left its the same except you find the varible which you wish to change and replace its positive number with a negative, -1 or -15 yet again depends on how much you want it to move.

Hope this helps and sorry I can't help any further
User avatar
instinct46
50+ Club
 
Posts: 75
Joined: Tue Mar 27, 2007 2:07 pm
Location: St Helens, England


Who is online

Users browsing this forum: No registered users and 0 guests