PowerPoint Creative
Log In or Register to participate in PPC!
PowerPoint Creative
Log In or Register to participate in PPC!

Go down
Jarek
Jarek
Featured Creator
Featured Creator
Posts : 341
Join date : 2018-12-06
Location : Poland

Using the Keyboard to Move Shapes Empty Using the Keyboard to Move Shapes

Mon Aug 29, 2022 7:49 pm
Message reputation : 100% (2 votes)
Something I didn't consider possible: playing a game in Powerpoint in real time using keyboard input. And yet here it is as proof - a sample VBA code that lets you stear a spaceship (a Powerpoint shape  Using the Keyboard to Move Shapes 1f606) using either the arrow keys or WSAD. Press SPACE to fire. Nothing more happening. I added a few function key actions to illustrate the use of different keys. Couldn't get the mouse buttons to work, though.

The VBA code is not password protected for anyone to be able to mess around with it and hopefully get more out of this. You can always use the regular Powerpoint tools and not necessarily VBA!

Run the presentation, click the START button and you're ready to test the keyboard keys.

Using the Keyboard to Move Shapes Zrzut_13

Spaceship1

The downside: because of Powerpoint limitations making changes to the code is not easy and the forced coding doesn't allow for much coding manoeuverability. Personally, I much rather prefer the directional pad I used in Pacman.


Last edited by Jarek on Mon Sep 05, 2022 5:10 am; edited 1 time in total

rusnakcreative likes this post

rusnakcreative
rusnakcreative
Administrator
Administrator
Posts : 633
Join date : 2017-08-16
https://www.rusnakcreative.com

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Wed Aug 31, 2022 6:58 pm
Your code looks much more polished than mine and it runs pretty well! I also loved how you have the ship able to wrap around to the other side if you fly it towards the edge of the screen. I could see you turning this into like an Asteroids game!
Jarek
Jarek
Featured Creator
Featured Creator
Posts : 341
Join date : 2018-12-06
Location : Poland

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Thu Sep 01, 2022 7:06 am
It did cross my mind...

...but because of the keyboard being used I cannot make the ship keep on moving when no key is pressed. I managed that with Pacman because I didn't use keyboard input.
Jarek
Jarek
Featured Creator
Featured Creator
Posts : 341
Join date : 2018-12-06
Location : Poland

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Mon Sep 05, 2022 5:09 am
Here's another take at the spaceship: the movement resembles more like in the Asteroids game. With the left and right arrows (or A & D) you rotate the ship and the up arrow (or W) moves the ship forward. As usual space fires the laser.

I don't know how to shoot or move the spaceship in directions other than up-down and left-right. I also haven't figured out how to detect collision if asteroids were to appear and fired at with the laser.

Spaceship2

So, I leave it at that for the time being.
johnr
johnr
Administrator
Administrator
Posts : 941
Join date : 2017-08-17
Location : UK
http://www.powerpointgames.uk

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Thu Sep 08, 2022 4:31 am
Some impressive steps forward, and rotational, with this keyboard control.

I could see this working with the shape in the centre of the screen but only rotating and firing at approaching asteroids / aliens that come in from different directions. I appreciate that this is probably too much to expect as a possibility.

All this is worth working on and developing if you can.

Jarek
Jarek
Featured Creator
Featured Creator
Posts : 341
Join date : 2018-12-06
Location : Poland

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Wed Sep 28, 2022 6:22 am
I got the spaceship to fire in 8 directions with 2 diagonals added. Without trigonometry. Yet. A simplified work-around that gives a reasonable result.

Now if I could also make it move diagonally I would be on my way to what John suggested earlier - some kind of an Asteroids game...

Spaceship3


I also noticed that PPT tends to crash on me from time to time when exiting slide show view. I presume it's because of forcing the use of the keyboard. That encourages me to revert back to my trusted Arrow Pad...
johnr
johnr
Administrator
Administrator
Posts : 941
Join date : 2017-08-17
Location : UK
http://www.powerpointgames.uk

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Wed Sep 28, 2022 10:28 am
It's great that you've got the rotation and the firing from all angles. It made me wonder if you really need any further movement: up; down or diagonal.

You could have the spaceship just in the centre and rotating to shoot at aliens or asteroids that attack from each compass point towards the centre. Levels could be based on the speed and/or numbers of aliens attacking at once. Just a thought.

Jarek
Jarek
Featured Creator
Featured Creator
Posts : 341
Join date : 2018-12-06
Location : Poland

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Thu Sep 29, 2022 4:03 am
Good idea  Using the Keyboard to Move Shapes 1f4a1
Jarek
Jarek
Featured Creator
Featured Creator
Posts : 341
Join date : 2018-12-06
Location : Poland

Using the Keyboard to Move Shapes Empty Spaceship5 - a continuing story of progress with an idea

Sat Oct 01, 2022 10:34 am
Message reputation : 100% (1 vote)
In the meantime...

...Spaceship5!



  • Goes in every direction to give more control over flight
  • Fires at every angle to give more fire power
  • Goes off screen smoothly in every direction to reappear on the other side for great effects
  • Increments can be even as small as 1 degree (unnecessary in Powerpoint)
  • Works with the keyboard - arrow keys or WASD - for a true gaming experience
  • Menu selection with function keys or a mouse proves Powerpoint can be exploited to better simulate non-Powerpoint games


You asked me John why would I do all this if what was, was already good enough? I think it's because I can! It's still not a game but only a fraction, a module, of something that could be a game. It's getting me closer to what you suggested - some kind of an asteroids shooter?...

rusnakcreative likes this post

rusnakcreative
rusnakcreative
Administrator
Administrator
Posts : 633
Join date : 2017-08-16
https://www.rusnakcreative.com

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Sat Oct 01, 2022 11:53 am
Wow! I knew you could pull it off and get it moving and firing in any direction!

You can try to add separate moving asteroids to shoot, but I worry about it really lagging the game down by having to redraw each asteroid and your ship like you saw in my space invaders concept. What I might suggest is instead of floating asteroids around, what if the things you shoot at were static? What if you had to navigate your ship through obstacles, like a maze, and shoot at some obstacles in the way to progress? The big hurdle would be programming the object detection for the lasers and the ship if it touches a wall. Also thinking about if the gameplay, do you want the game to end the second you bump into something, or maybe add a lives or damage detection system where you lose a certain percentage of damage with each hit? Some ideas to think about. Really impressed with this new development and look forward to see where you take this next!

Jarek likes this post

matto
matto
Featured Creator
Featured Creator
Posts : 81
Join date : 2022-08-11
Location : Japan

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Fri May 26, 2023 1:30 am
Man, I have to say that even after studying vba for a year, this code still makes my head spin. In its most simplistic interpretation, it's basically two steps. 

1. Register either a left, right, up or down key press with vbKey
2. run a subroutine that changes the coordinate data of the shape/image. 

Another possible use case may be for RPGs. 

JadeJohnsonIndustries™
JadeJohnsonIndustries™
PPT Master
PPT Master
Posts : 191
Join date : 2022-03-11
Location : I can presently be found at my current interdimensional coordinates.
https://gamejolt.com/@JadeJohnsonIndustries/games

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Fri May 26, 2023 9:05 pm
Collisions, ARE, possible in VBA:
https://www.youtube.com/watch?v=IlxQYzXHLik
Sponsored content

Using the Keyboard to Move Shapes Empty Re: Using the Keyboard to Move Shapes

Back to top
Permissions in this forum:
You cannot reply to topics in this forum