NowandaZ
04-30-2018, 07:12 AM
Hi there
I'm a civil engineering student, so my programming skills are below average. But we need to create a game in excel. The only knowledge I have is java, but excel is totally different.
The game I'd like to make is the following: https://www.youtube.com/watch?v=kJCXPzRWH0k&t=76s
I've managed to make the rectangle move from side to side, but the speed isn't good. I want it to look smooth just as in the real game. Also we need to make the rectangle stop, add a new rectangle underneath and make that new one move.
Then it needs to register how much the second rectangle differs from the first one so the next one decreases in size.
Any help is welcome!
Thank you
CODE:
Sub proberen()
Set MyDocument = Worksheets(1)
MyDocument.Shapes.AddShape msoShapeRectangle, 0, 0, 150, 15
Call naam
End Sub
Sub naam()
ActiveSheet.Shapes(1).Select
Selection.Name = "vierkant"
End Sub
Sub bewegen1()
rep_count = 0
Do
rep_count = rep_count + 100
Blad1.Shapes("vierkant").Left = rep_count
Application.Wait Now + TimeSerial(0, 0, 1)
Loop Until rep_count = 600
End Sub
Sub bewegen2()
rep_count = 600
Do
rep_count = rep_count - 100
Blad1.Shapes("vierkant").Left = rep_count
Application.Wait Now + TimeSerial(0, 0, 1)
Loop Until rep_count = 0
End Sub
Sub bewegen()
Do
Call bewegen1
Call bewegen2
Loop
End Sub
I'm a civil engineering student, so my programming skills are below average. But we need to create a game in excel. The only knowledge I have is java, but excel is totally different.
The game I'd like to make is the following: https://www.youtube.com/watch?v=kJCXPzRWH0k&t=76s
I've managed to make the rectangle move from side to side, but the speed isn't good. I want it to look smooth just as in the real game. Also we need to make the rectangle stop, add a new rectangle underneath and make that new one move.
Then it needs to register how much the second rectangle differs from the first one so the next one decreases in size.
Any help is welcome!
Thank you
CODE:
Sub proberen()
Set MyDocument = Worksheets(1)
MyDocument.Shapes.AddShape msoShapeRectangle, 0, 0, 150, 15
Call naam
End Sub
Sub naam()
ActiveSheet.Shapes(1).Select
Selection.Name = "vierkant"
End Sub
Sub bewegen1()
rep_count = 0
Do
rep_count = rep_count + 100
Blad1.Shapes("vierkant").Left = rep_count
Application.Wait Now + TimeSerial(0, 0, 1)
Loop Until rep_count = 600
End Sub
Sub bewegen2()
rep_count = 600
Do
rep_count = rep_count - 100
Blad1.Shapes("vierkant").Left = rep_count
Application.Wait Now + TimeSerial(0, 0, 1)
Loop Until rep_count = 0
End Sub
Sub bewegen()
Do
Call bewegen1
Call bewegen2
Loop
End Sub