howto: code with comments
March 4, 2006 at 3:07 pm | Posted in gamemaker, howto, problems | Leave a commentSome students have been blogging a blow by blow description of every single thing they did to solve the problems.
This is a lot of work but also hard to read and follow because there is so much description in there.
A good alternative is to describe how the code works rather than what you did to create the code.
Here’s an example, using problem six:
A ball goes through a goal and the score goes up by oneā¦the score does not go up if the ball misses the goal
goal miss
goal score
After you have made your demo click the Show Information button on your most important objects to obtain the code. You can copy and paste this into your blog like I have done below.
I think it’s best to intersperse comments about the code inside the code so that you explain the code as you go along. Focus on the main important parts of your code that explains how the problem was solved. Don’t write about every single thing because then the important stuff gets lost.
Use bold and italics to make it more readable. Unfortunately we don’t seem to have colour writing in wordpress.
Information about object: objBall
Step Event:
if expression y is less than one
set the score relative to 1
destroy the instance
create instance of object objBall at position (216,192)
Comment: If the ball goes through the goals, then do all of these things: increase the score by one, destroy the ball (so the score won’t keep going up) and create a new ball in the original position
Collision Event with object objWall:
bounce not precisely against solid objects
Comment: If the ball misses the goals then bounce it back into the playing arena
Keyboard Event for Key:
set speed to 5 and direction to 45+random(90)
Comment: random(90) will output a number between 0 and 89. then add this to 45 and you get a direction between 45 and 134. So sometimes the ball will go into the goals and sometimes it will miss. Just like real life.
Other Event: Outside Room:
jump to the start position
start moving in directions 000010000 with speed set to 0
Comment: If the ball leaves the room then jump back to start ready to kick for goal again.
making gifs
February 18, 2006 at 4:00 am | Posted in gamemaker, sprites | 1 CommentStudents haven’t been posting their finished gifs into wordpress. After you make your animation then save it as a gif in game maker. Then I found you have to load it in GIMP and save it there, otherwise it won’t loop. Finally, upload it to wordpress as a full size image, not a thumbnail. Then you can see your animated gifs in wordpress! Remember to do a hard one (different sized frames) as well as an easy one.
problem 2:
2) Make an animation from a strip sheet of stills.
a) one where all the slides are the same size (easier)
b) another where the slides are of varying sizes (harder)
Solution:
Hint:
Sprite editor > File > Create from Strip
Sprite editor > File > Add from Strip
Hint: For slides of varying sizes start with the largest size and add the smaller sizes later and rearrange order. It can be a fiddly, tedious process!
Suitable strip sheets are astro_sheet.gif, shadow_sheet.gif, kadotsu_sheet.gif
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

