Prof. Monster's BGE Guide to Messages - exercise thread

Hi blenderheads

This is the exercise thread for
Prof. Monster’s BGE Guide to Messages incl. Healthbar tutorial

If you liked the tutorial and you are interested to do some exercise you will find some homework here :yes:.
The attached files are start files without the solution ;).

How to run the exercise:

  • Pick one of the exercises
  • Read what to do in the post.
  • Download and open the blend file.
  • Add objects and logic to create your solution.
  • You are done when the game does what the exercise requested
  • Post some feedback

Hints:

  • Have the guide open for reference
  • The blend file contains a short note on the exercise too
  • Have a look at the objects in the blend file

Do not worry the exercises are not difficult.

If you have questions or concerns or you want to present your solution just post here. You can also send me a private message if you do not want to ask in public.
It would be nice if you let me know what you think about this thread (good/bad/boring/to hard).
Any feedback is welcome.

When you are happy with your solution you can post it here. You can ask for a review too.

I’m looking forward to see what solutions you can think of :eyebrowlift:.
Monster

You can find the exercises at the following posts:

Pointer Display


The duty is to add another Value display.
Add a pointer that goes from left (min) to right (max).

Requirements:

  • placed in scene Overlay
  • It should show the bouncing of the yellow ball as the other Value Providers.
  • The pointer display should have a pointer pointing at a measure (left min right max).
  • With increasing value it moves the pointer left until the most measure unit.
  • The pointer should not exceed the maximum!

Attachments

Homework I - Pointer Display.blend (100 KB)

Scale/Color Display


The duty is to add another Value Display.
Add a growing circle that makes a transition from green (<=min) to red (>=max).

Requirements:

  • placed in scene Overlay
  • It should show the bouncing of the yellow ball as the other Value Providers.
  • The display should start small and green.
  • With increasing value it grows and turns slowly from green to red.
  • The display should not exceed the maximum!

Attachments

Homework II - ScaleColor Display.blend (106 KB)

Another Value Provider


The duty is to add another Value Provider.
Add a red ball with a different elasticity placed at another high.
It should provides its bounces too.

Modify the Text Display to display the bounces of the red ball rather than of the yellow ball.
The Graphical Display keeps showing the bounces of the yellow ball.

Attachments

Homework III - ValueProvider .blend (106 KB)

Cool stuff Monster! Unfortunately my two baby girls do not give me much time with Blender these days- can we describe how we would do an exercise? I don’t want to ruin this for anyone else.

And thanks for doing all this!

Hi Rubbernuke,

this is a good idea. I updated the top post. Do you think this is better?

PS: give your baby girls a hug from a Monster :slight_smile:

I have solved the first :

solution:
make a mesh with form of arrow, put the head in the minimum value with rotation default
get the range max from the rotation of arrow(90° degrees about)
from arrow get the value of ball

suppose which the max numb of bounce is 20

90/20 =4.5 (degrees)

so the orientation of arrow is:

value = ball.value
value = min(value,20)
factor = 90 / 20

ori = own.orientation.to_euler()
ori[1] = math.radians(value * factor)
own.orientation = ori

:wink:

Marco, yes this sounds like a good solution.
Anyone has other solutions?

The way I was thinking was something simpler-

The dial can be animated, so you could then hook up an f curve/ipo/ action logic block. You can then get the bounce property to drive the animation via a message.

This approach could be used for the second test too, so a ball can be small and green at frame 1, and at frame 100 be large and red (assuming this is the way to keyframe colours). So with each bounce, the animation for the green ball advances by a set amount (say, each bounce = 5 frames).

I’m a little inexperienced with the new action logic block, but in older versions f curves could be set to run from properties.

Rubbernuke, that is indeed the solution I prefer. The animation system works like before except you just use the action actuator rather than the IPO/F-Curve actuator which is gone since 2.62.
As MarcoIT shows there are multiple solutions.

Monster,

I’ve tried to recreate what you’ve done here. Basically opened one of your homework blends and copied it point for point to create a counter. I’m looking for it to count on the press of the space bar. If I change collision to keyboard (space) in your file it works perfectly. In my blend file it won’t work. Could you take a look at the blend and see if there is something I’m missing.

Most of the property names and such match yours exactly for ease of following.

I’m just stumped. Using 2.62 by the way

Thanks,
Stephen

CounterHelp.blend (478 KB)

No problem:

  • You need the S2A.py from the demo file. Load it into your Text Editor or place it next to your blend file.
  • Connect the OR controller with the Actuator “aBounces” of the Cube (Scene)

Then is should work :slight_smile:

Facepalm.

Thanks, Monster. I guess I was thinking the S2A was new, built in funcitionality. That solved the problem.

I appreciate the help.

Stephen