|
| Welcome to PowerPoint Heaven Discussion Board. We hope you enjoy your visit.
You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.
Join our community!
If you're already a member please log in to your account to access all of our features:
|
Keyboard Control, 3D Manipulation & Other Secrets, All of my research released.
| Callum's Projects |
|
PowerPoint Guru
      
Group: PB
Posts: 1,824
Member No.: 814
Joined: 16-July 10

|
Introduction: In this extremely long-awaited tutorial, I will share some of my most treasured PowerPoint knowledge. Since my time here, I have done everything I can to break boundaries and solve problems that previously defeated people en masse including the utilisation of keys pressed by a user as a means of input, manipulating 3D objects within a presentation, gathering information about a user and their computer, making an event occur every x milliseconds and more. I'd first like to thank John Wilson for all of his help in my research and for being so generous in sharing his font of all things VBA. Please note that the steps in the tutorial are aimed at PowerPoint 2010 users, there may be slight differences in 2007 and earlier so please bear that in mind! I suppose I'd better stop rambling as you're only here for the codes after all; and so with no further ado, I present to you all of my research into PowerPoint and VBA. Oh and I will be adding to this post all the time, so keep checking back! Keyboard Control Tutorial: What is keyboard control? Well, in principal, it is detecting the keys a user presses on their keyboard whilst using your presentation. This is surprisingly more difficult that you might initially expect. Does it require API(s) or other programs to be installed? Some methods of keyboard control would require this, but my one doesn't at all luckily. Many people are hesitant to allow a presentation to use APIs considering exactly what they're capable of. For this very reason, I (like many others) chose not to use them if there is an alternative. Luckily for us, there is! When will the tutorial actually start? Fear not, there's only one more question. What is the extent of compatibility with keyboard control? As you will probably know, I have released many examples of keyboard control here, and I was surprised myself by the extent of compatibility. It seems to function correctly on Windows XP, Vista and 7, as well as Microsoft Office 2003, 2007 and 2010! Yahoo! Step 1: Open up PowerPoint and save your presentation as a Macro-Enabled Presentation named "Keyboard Control Test". I ask you to do this so you don't forget to save it as a macro-enabled presentation later, and lose the VBA (has happened to me many times before). Step 2: For my method of keyboard control to work you will need to insert an ActiveX TextBox for the user to select. Open the developer tab (if you don't have a developer tab go to PowerPoint Options -> Customize Ribbon - > Developer, or Google "Developer Tab" + your PowerPoint version for a tutorial). From the developer tab, select the icon highlighted below:  And place it along the top of the slide like so: Step 3: For this to work, grids are best as they ensure the character doesn't get trapped and isn't able to escape an area. You will need to border off the playing area with a shape; to do this insert a rectangle and change its size to those below so it will fit in the grid perfectly:  Then align it to the center and to the middle so it is exactly in the center of the slide:  Feel free to decorate this new shape and change the slide background so it looks a little better and the TextBox at the top of the slide is more visible, for example: Step 4: Now it is time to create the character. For this example, simply use a smiley face sized 2.54 by 2.54 so it fits in the grid, and place it exactly in the corner of the large rectangle we made earlier:  Feel free to decorate this character too like I did in the example. Here is an image showing every possible place the player's character can move to on the grid that we've created: Step 5: Now it's time to make an area that the player can't go into; let's call this a "solid" shape. Create another rectangle (sized 2.54 by 2.54), and place it on top of the character's head, exactly in the center, like so:  Then copy the character and place it somewhere touching the other side of the playing area, and extend the new rectangle until it is touching the right character exactly, like this:  After, delete the character that you copied to the right side of the playing area as it was only used to ensure the solid shape fit correctly inside the grid. Feel free to decorate the rectangle so it matches your other shapes, like I did in the image above. Here is an updated version of possible character positions:  And remember to keep saving! Step 6: Now we need a "level up" shape that will allow the player to move to the next level when their character touches it. We'll use a star; so go ahead and insert a star and resize it to 2.54 by 2.54, then place it in the top-right corner like so:  As always, feel free to decorate this new shape. Step 7: Create a rectangle that covers the whole slide, right click it, select Edit Text and add a congratulations message to it, like mine:  Create another rectangle that covers the whole slide, right click it, select Edit Text and add the following message "^^ Click the Box Above to Begin ^^". Like this: Step 8: It is now time to rename the shapes so the VBA will be easier. Open up the selection pane from the Home tab like so:  Rename the shapes in the presentation like I have ( exactly [they are case-sensitive]!), and click the eye icon to the right of the shape named "FinishMessage": Step 9: Now the tutorial will get slightly more complicated as we're going to start working with VBA. To start off with, right click on the TextBox at the top of the slide, and select Properties. From there, changed "Locked" to "True", like so:  You may also want to center the text too, by changing "TextAlign" to "2 - fmTextAlignCenter", like so:  The text inside of this TextBox will be added later by VBA when you test your game. Step 10: Close the properties menu, and double click on the TextBox, a window should open like this:  Select all of the text, and click delete on your keyboard so there is no longer any text. Step 11: I considered going through each part of the code and explaining it to you, but I didn't know if people would want that, and so I will simply provide the code for you. Copy all of the code inside of the CODE box below and paste it into the window. | CODE | Option Explicit Private Sub Status_GotFocus() Dim objStatus As Shape Dim objMsgStrt As Shape Dim objMsgFnsh As Shape Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objMsgStrt = ActivePresentation.Slides(1).Shapes("StartMessage") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") objStatus.OLEFormat.Object.Text = "Game in progress..." objMsgFnsh.Visible = msoFalse objMsgStrt.Visible = msoFalse End Sub
Private Sub Status_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim objChar As Shape Dim objStatus As Shape Dim objWall As Shape Dim strMaxTop As String Dim strMaxLeft As String Dim strMaxBottom As String Dim strMaxRight As String Dim strLefTemp As String Dim strTopTemp As String Dim strMove As Integer Dim objLevelUp As Shape Dim objPlayArea As Shape Dim objMsgFnsh As Shape Set objChar = ActivePresentation.Slides(1).Shapes("Character") Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objWall = ActivePresentation.Slides(1).Shapes("Wall") Set objLevelUp = ActivePresentation.Slides(1).Shapes("Star") Set objPlayArea = ActivePresentation.Slides(1).Shapes("Border") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") strMaxTop = "90" strMaxBottom = "378" strMaxLeft = "36" strMaxRight = "612" strMove = objChar.Width If KeyCode = vbKeyLeft Then objChar.Rotation = "270" strLefTemp = objChar.Left strTopTemp = objChar.Top If objChar.Left - strMove <= strMaxLeft Then objChar.Left = strMaxLeft Else objChar.Left = objChar.Left - strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If ElseIf KeyCode = vbKeyRight Then objChar.Rotation = "90" strLefTemp = objChar.Left strTopTemp = objChar.Top
If objChar.Left + strMove >= strMaxRight Then objChar.Left = strMaxRight Else objChar.Left = objChar.Left + strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If ElseIf KeyCode = vbKeyUp Then objChar.Rotation = "0" strLefTemp = objChar.Left strTopTemp = objChar.Top If objChar.Top - strMove <= strMaxTop Then objChar.Top = strMaxTop Else objChar.Top = objChar.Top - strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If ElseIf KeyCode = vbKeyDown Then objChar.Rotation = "180" strLefTemp = objChar.Left strTopTemp = objChar.Top If objChar.Top + strMove >= strMaxBottom Then objChar.Top = strMaxBottom Else objChar.Top = objChar.Top + strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If End If If objChar.Left < objLevelUp.Left + objLevelUp.Width And objLevelUp.Left < objChar.Left + objChar.Width Then If objChar.Top < objLevelUp.Top + objLevelUp.Height And objLevelUp.Top < objChar.Top + objChar.Height Then objMsgFnsh.Visible = msoTrue objStatus.OLEFormat.Object.Text = "" End If End If End Sub
Private Sub Status_LostFocus() Dim objStatus As Shape Dim objChar As Shape Dim objPlayArea As Shape Dim objLevelUp As Shape Dim objMsgStrt As Shape Dim objMsgFnsh As Shape Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objChar = ActivePresentation.Slides(1).Shapes("Character") Set objPlayArea = ActivePresentation.Slides(1).Shapes("Border") Set objLevelUp = ActivePresentation.Slides(1).Shapes("Star") Set objMsgStrt = ActivePresentation.Slides(1).Shapes("StartMessage") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") objStatus.OLEFormat.Object.Text = "Click here to begin..." objChar.Rotation = "0" objChar.Left = 36 objChar.Top = 378 objMsgStrt.Visible = msoTrue objMsgFnsh.Visible = msoFalse End Sub
|
It should look something like this:  Now, close that window by clicking "x" in the top-right corner. Save your presentation, then test it out. If you followed every step perfectly, you will have your very own keyboard control game! Feel free to go back, and change things around a little. The character can be a group or an image as long as it is still named "Character" in the Selection Pane and it is sized 2.54 by 2.54 exactly (you can achieve this by adding an invisible square of that size behind the character if yours is too small). You can also add new shapes and items to the game to make it look better. Please feel free to experiment with the code to see what you can do with it; I can't wait to see for myself! Here is the file that I created by using this tutorial (in case you made a mistake): http://www.mediafire.com/?d7wvz6d61ogveps
|
|
|
| (-_-) |
|
PowerPoint Addict
    
Group: PB
Posts: 434
Member No.: 1,105
Joined: 12-August 11

|
Oh...creating every possibility that the player could go to. I could see why AI would be hard :P
However can't you do the same thing with AI? I mean, make it go through a pred defined path, and every other second, the AI would move accordingly? Or is the code just really hard to debug O_O
If you do get that right, then lets say you touch the 'AI' (We'll name this AI 'Girl A' for 'live it' references :P) Let's say you touch this 'Girl A' you siad that you've already had the code to recongize if an object was touching another object, so can't you make dialogue choices appear? Or at least text pop up, then after ward press 'Enter' to close the text box?
Im also very curious about character facing, and to what extent CA (Motion paths) can be added to make the movement less...'Suddenly-teleport-1-block-infront-of-me-ness'
I want this since I want my person to be able to face right/left, and let's say after much struggle, your able to apply a simple attack button (ie a blade) when the 'Enemy' is touched by the blade, the 'Health' decreases, and a bar shows. Although hit counter's would be pretty hard to do...not to mention to let is show how much damage you did, and in real-time (._.) ...
Although I have to asy, would you have to create every possibility that the player moves right, and faces left or forward, and every different place the player could slash? I can see if this was like this, this would be really hard and time consuming to correctly make a char. face any direction, and attack a 'Enemy' O_O
Also, I've also wondered about using the mouse in-game aswell, like during combat, if you want to use range attacks, you have to click them. Howver, would this also be time-consuming, having an arrow from every possible sqaure shoot every other square there is (And that's all if you got bullets to work fine!)
The keyboard part is done, but that's just the movement and mobility, the real 'fun' starts with the game mechanics itself, which I would imagine take alot longer then anything else, even the best, most realistic game graphics to PS3/Xbox360 char.'s.
(This would mean where enemies move, what paths they have to them, how close you have to be in order for the enemy to 'see' you and if it's even possible 'follow' you until there withing attacking range, not to mention the ability to level-up in real experince systems, and mana, dex, energy, strength, stamina, endurance, constitution, also having the ability of having random itmes, weapons, and armor with random +HP fitting the level your in, etc)
(Above, YEARS!)
|
|
|
| (-_-) |
|
PowerPoint Addict
    
Group: PB
Posts: 434
Member No.: 1,105
Joined: 12-August 11

|
| QUOTE (CeranBlade @ Mar 25 2012, 10:43 PM) | | QUOTE ((-_-) @ Mar 25 2012, 12:51 PM) | Oh...creating every possibility that the player could go to. I could see why AI would be hard 
However can't you do the same thing with AI? I mean, make it go through a pred defined path, and every other second, the AI would move accordingly? Or is the code just really hard to debug O_O
If you do get that right, then lets say you touch the 'AI' (We'll name this AI 'Girl A' for 'live it' references ) Let's say you touch this 'Girl A' you siad that you've already had the code to recongize if an object was touching another object, so can't you make dialogue choices appear? Or at least text pop up, then after ward press 'Enter' to close the text box?
Im also very curious about character facing, and to what extent CA (Motion paths) can be added to make the movement less...'Suddenly-teleport-1-block-infront-of-me-ness'
I want this since I want my person to be able to face right/left, and let's say after much struggle, your able to apply a simple attack button (ie a blade) when the 'Enemy' is touched by the blade, the 'Health' decreases, and a bar shows. Although hit counter's would be pretty hard to do...not to mention to let is show how much damage you did, and in real-time (._.) ...
Although I have to asy, would you have to create every possibility that the player moves right, and faces left or forward, and every different place the player could slash? I can see if this was like this, this would be really hard and time consuming to correctly make a char. face any direction, and attack a 'Enemy' O_O
Also, I've also wondered about using the mouse in-game aswell, like during combat, if you want to use range attacks, you have to click them. Howver, would this also be time-consuming, having an arrow from every possible sqaure shoot every other square there is (And that's all if you got bullets to work fine!)
The keyboard part is done, but that's just the movement and mobility, the real 'fun' starts with the game mechanics itself, which I would imagine take alot longer then anything else, even the best, most realistic game graphics to PS3/Xbox360 char.'s.
(This would mean where enemies move, what paths they have to them, how close you have to be in order for the enemy to 'see' you and if it's even possible 'follow' you until there withing attacking range, not to mention the ability to level-up in real experince systems, and mana, dex, energy, strength, stamina, endurance, constitution, also having the ability of having random itmes, weapons, and armor with random +HP fitting the level your in, etc)
(Above, YEARS!) |
Thats not really AI. Thats a call and response of an NPC
|
Yes, whatever you call that stuff, im not into game mechanics much at all
|
|
|
| Callum's Projects |
|
PowerPoint Guru
      
Group: PB
Posts: 1,824
Member No.: 814
Joined: 16-July 10

|
Well funny you should mention AI because I was thinking the other day "I should really start drafting the AI for Live It!". As you will know, characters will need to eat and sleep to survive and so it would seem stupid to not implement AI as your character would soon be the only living one in the whole game as the others would just stand there and die. Another type of AI I will need it route calculating. I will need a way for characters to know which way to go when you click on the toilet, and which blocks they can and can't walk through (we wouldn't walk characters infinitely walking into a wall when there is a door a few feet to the left). Next comes the economy, other characters will be earning money from their jobs and they also need to buy food, so I need to ensure they know when the fridge is empty and they need to go shopping. This also applies to furnishing their homes; if a character earns a bonus, why not let them buy a new television with the money? Also, to ensure that money doesn't run out, the owners of shops will have to spend the money they earn too. Money spent paying for furniture bought from the edit-mode catalogue will go into the bank where it will be used to pay characters for work. This 'pool' of cash in the bank will slowly increase in size over time to compensate for progression in the game and promotions; meaning characters need to be paid more. I've merely outlined a few of the branches of AI that I'll need to create for "Live It!". The AI will probably be a large part of the drafting process as it will require an awful lot of thinking so characters don't act strangely. As for combat, I thought I'd spend a few minutes seeing what I could come up with. It's simple, but it was only a quick test: http://www.mediafire.com/?92ft8hv192fj96w
|
|
|
| CeranBlade |
|
PowerPoint Master

Group: Global Moderators
Posts: 2,474
Member No.: 654
Joined: 30-November 09

|
As a video game programmer, I have to understand this code;  Okay... here goes... Private Sub Status_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim objChar As Shape Dim objStatus As Shape Dim objWall As Shape Dim strMaxTop As String Dim strMaxLeft As String Dim strMaxBottom As String Dim strMaxRight As String Dim strLefTemp As String Dim strTopTemp As String Dim strMove As Integer Dim objLevelUp As Shape Dim objPlayArea As Shape Dim objMsgFnsh As Shape //blah blah defining stuff Set objChar = ActivePresentation.Slides(1).Shapes("Character") Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objWall = ActivePresentation.Slides(1).Shapes("Wall") Set objLevelUp = ActivePresentation.Slides(1).Shapes("Star") Set objPlayArea = ActivePresentation.Slides(1).Shapes("Border") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") //Sets and assigns the names to the objects on the first slide strMaxTop = "90" //Not sure why these numbers were chosen for the interger values, but I'm guessing its the size of the boundary. strMaxBottom = "378" strMaxLeft = "36" strMaxRight = "612" strMove = objChar.Width //This makes sense. The object will only move its width. If KeyCode = vbKeyLeft Then objChar.Rotation = "270" //Rotate 270 degrees, obviously strLefTemp = objChar.Left //This has something to do with the text box, but I'm not sure what. strTopTemp = objChar.Top If objChar.Left - strMove <= strMaxLeft Then objChar.Left = strMaxLeft //strMove is how far it moves, therefore, the character will not move past the set border. Else objChar.Left = objChar.Left - strMove //Move if it won't go past the border. End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then //The ball will not travel into the space the wall occupies? If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp //Another reference to the text box, I believe. Not sure what these strings have to do with the entire code. Am I missing something? End If End If //Rest of code is a huge line of else ifs and the "you win" macro
|
|
|
| Callum's Projects |
|
PowerPoint Guru
      
Group: PB
Posts: 1,824
Member No.: 814
Joined: 16-July 10

|
Well done; you were very close!  I hope this helps you understand the code:
| QUOTE | Option Explicit 'Ensures that all variables are declared; good coding practice. Private Sub Status_GotFocus() 'Run the below code when the TextBox at the top of the page is clicked, or "gains focus". Dim objStatus As Shape Dim objMsgStrt As Shape Dim objMsgFnsh As Shape 'Declare necessary variables. Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objMsgStrt = ActivePresentation.Slides(1).Shapes("StartMessage") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") 'Set declared variables. objStatus.OLEFormat.Object.Text = "Game in progress..." 'Change the text within the TextBox to "Game in progress...". objMsgFnsh.Visible = msoFalse 'Ensure that the "You've completed the game" message is hidden. objMsgStrt.Visible = msoFalse 'Ensures that the "^^ Click here to begin ^^" message is hidden. End Sub
Private Sub Status_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) 'Run the below code when a keyboard key is pressed whilst the TextBox "has focus" Dim objChar As Shape Dim objStatus As Shape Dim objWall As Shape Dim strMaxTop As String Dim strMaxLeft As String Dim strMaxBottom As String Dim strMaxRight As String Dim strLefTemp As String Dim strTopTemp As String Dim strMove As Integer Dim objLevelUp As Shape Dim objPlayArea As Shape Dim objMsgFnsh As Shape 'Declare necessary variables. Set objChar = ActivePresentation.Slides(1).Shapes("Character") Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objWall = ActivePresentation.Slides(1).Shapes("Wall") Set objLevelUp = ActivePresentation.Slides(1).Shapes("Star") Set objPlayArea = ActivePresentation.Slides(1).Shapes("Border") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") 'Set declared variables. strMaxTop = "90" 'The boundary's Y, or Top position value (this is the top boundary point). strMaxBottom = "378" 'The boundary's Y, or Top position + the boundary's height (gives us the bottom boundary point). strMaxLeft = "36" 'The boundary's X, or Left position (this is the left boundary point). strMaxRight = "612" 'The boundary's X, or Left position + the boundary's width (gives us the right boundary point). strMove = objChar.Width 'Assigns the character's width to a string. This is used to make the character move its own width. If KeyCode = vbKeyLeft Then 'If the key that is pressed is the left arrow key then... objChar.Rotation = "270" 'Rotate the character to the left. strLefTemp = objChar.Left 'Assigns the character's current Left position temporarily to a string. 'We must do this because in order to check if the character will collide with another shape, 'it would seem logical to move it there first. If the character is colliding with solid part, 'we can use its original Left and Top position to move it back (making a shape act "solid"). strTopTemp = objChar.Top 'Assigns the character's current Top position temporarily to a string. If objChar.Left - strMove <= strMaxLeft Then 'If the character has moved out of the left border then... objChar.Left = strMaxLeft 'Change its Left position to the maximum it can be while staying inside the border, 'This was one of the integers that we set earlier. Else 'Otherwise... objChar.Left = objChar.Left - strMove 'Let it move to the left by its own width. (Another of the integers we set earlier.) End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then 'If the character's position overlaps the wall's position then... objChar.Left = strLefTemp objChar.Top = strTopTemp 'Move it back to where it was before, using the temporary string we set earlier. End If End If 'The same explained above applies to the next 3 "elseif"s.
ElseIf KeyCode = vbKeyRight Then objChar.Rotation = "90" strLefTemp = objChar.Left strTopTemp = objChar.Top
If objChar.Left + strMove >= strMaxRight Then objChar.Left = strMaxRight Else objChar.Left = objChar.Left + strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If ElseIf KeyCode = vbKeyUp Then objChar.Rotation = "0" strLefTemp = objChar.Left strTopTemp = objChar.Top If objChar.Top - strMove <= strMaxTop Then objChar.Top = strMaxTop Else objChar.Top = objChar.Top - strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If ElseIf KeyCode = vbKeyDown Then objChar.Rotation = "180" strLefTemp = objChar.Left strTopTemp = objChar.Top If objChar.Top + strMove >= strMaxBottom Then objChar.Top = strMaxBottom Else objChar.Top = objChar.Top + strMove End If If objChar.Left < objWall.Left + objWall.Width And objWall.Left < objChar.Left + objChar.Width Then If objChar.Top < objWall.Top + objWall.Height And objWall.Top < objChar.Top + objChar.Height Then objChar.Left = strLefTemp objChar.Top = strTopTemp End If End If End If If objChar.Left < objLevelUp.Left + objLevelUp.Width And objLevelUp.Left < objChar.Left + objChar.Width Then If objChar.Top < objLevelUp.Top + objLevelUp.Height And objLevelUp.Top < objChar.Top + objChar.Height Then 'If the character's position overlaps the levelup star's position then... objMsgFnsh.Visible = msoTrue 'Ensure that the "You've completed the game." message is showing. objStatus.OLEFormat.Object.Text = "" 'Clear the text in the TextBox at the top of the page. End If End If End Sub
Private Sub Status_LostFocus() 'Run the code below when the player clicks off of the TextBox, or it "loses focus". Dim objStatus As Shape Dim objChar As Shape Dim objPlayArea As Shape Dim objLevelUp As Shape Dim objMsgStrt As Shape Dim objMsgFnsh As Shape 'Declare necessary variables. Set objStatus = ActivePresentation.Slides(1).Shapes("Status") Set objChar = ActivePresentation.Slides(1).Shapes("Character") Set objPlayArea = ActivePresentation.Slides(1).Shapes("Border") Set objLevelUp = ActivePresentation.Slides(1).Shapes("Star") Set objMsgStrt = ActivePresentation.Slides(1).Shapes("StartMessage") Set objMsgFnsh = ActivePresentation.Slides(1).Shapes("FinishMessage") 'Set declared variables objStatus.OLEFormat.Object.Text = "Click here to begin..." 'Reset the text inside the TextBox objChar.Rotation = "0" objChar.Left = 36 objChar.Top = 378 'Reset the character's position, and rotation. objMsgStrt.Visible = msoTrue objMsgFnsh.Visible = msoFalse 'Ensure that the "^^ Click here to begin ^^" message is visible, and the "You've completed the game" message is hidden. End Sub |
|
|
|
| RyeTech |
|
PowerPoint Geek
   
Group: PB
Posts: 221
Member No.: 1,306
Joined: 25-March 12

|
| QUOTE (Callum's Projects @ Sep 9 2012, 07:23 AM) | | QUOTE (RyeTech @ Sep 9 2012, 12:21 AM) | | QUOTE (Callum's Projects @ Sep 8 2012, 09:53 PM) | I want to update this, but out of interest, who would actually use an updated code in a project and post it here?
So far nobody has actually used this, much to my surprise! |
No one truly understand it...
|
Hum. Do you think I should redo the tutorial, with a much lower-brow approach?
|
Maybe. By the way, maybe people dont need to use it yet.
|
|
|
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|