Article Preview
Buy Now
COLUMN
Xojo Tennis Part 2
Playing tennis with Xojo and MBS
Issue: 23.3 (May/June 2025)
Author: Stefanie Juchmes-Simonis
Author Bio: Stefanie studied computer science at the University of Bonn. She came into contact with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 16,385
Starting Page Number: 70
Article Number: 23307
Resource File(s):
project23307.zip Updated: 2025-04-30 22:34:20
Related Link(s): None
Excerpt of article text...
In the first part of this series, we set up the scene for our tennis game. Now let's bring some movement into the game. The elements that move in our game are the ball on one hand and the two paddles of the players on the other. We will start with the players' paddles, which should move up and down. To simplify things initially, we will move these paddles using buttons, but in the next part, they will be controlled using Phidgets joysticks.
We want to perform certain movements in our scene when specific keys are pressed. For this, we will use the
KeyUp
events of our window. This event fires when a key that has been pressed is released. We can retrieve the character from this event as a string.However, some keys, such as the arrow keys, return specific strings. To compare these, we need to request the ASCII code from the return value to make the comparison possible. To identify the keys we want to use to control player 1 and player 2, we can first add the following line to the event and then press the corresponding keys:
MessageBox Asc(Key).ToString
...End of Excerpt. Please purchase the magazine to read the full article.