RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
RKSoft Tutorial - Jump and Run with hardmap
So, here is my little tutorial for you if you want to make a plattform game like Super Mario. The game contains 2 enemies and a playable level to show
how it works.
The features are:
- one playable level with a hardmap (see screens.fpg)
- 2 enemies, you can jump on their head to kill them
- animated blocks and coins
- a final with animation
- a basic title screen
- controls are cursor keys for moving and jumping and left shift to run
The code has some remarks for your information. Take a look into the player process how it works with the collision (to hardmap), jumping, running
etc. I hope it helps somebody to making games like this. If you have questions, i will answer all!
Permissions to use this code is free for all and no needs to copyright to me! But it will be nice when you will do. The copyright of the player
graphic is by me and you are not allowed to use them without my permission! The tileset (graphic blocks) are copyright by Black Squirrel from Mario
Fan Game Galaxy!
Allowed are:
Use this code if you want and make changes. The font is by me and for free to use.
Attachment: Tutorial 1 - jumpman.zip (587kB) This file has been downloaded 1863 times
|
|
MikeDX
|
|
This is beautiful. Thanks Roland!
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
Next tutorial will be the same but with tiles and not with hardmap. And, a simple level editor for it. I think it will help more people.
|
|
willicab
DIV Junior
Posts: 12
Registered: 12-7-2016
Member Is Offline
|
|
Excellent work!!
|
|
dom cook
Div Pro
Posts: 387
Registered: 4-3-2016
Member Is Offline
|
|
Looking good. Are you going to make a game or just some Tutorials?
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
Currently, only tutorials because there is a memory bug in compiled exe for Windows. Maybe, after a fix i remake some little Atari 2600 games with
better graphics. For currently projects, you can take a look on my homepage at https://rksoft.info . I made some mock-ups for the Commodore Plus/4 homecomputer. ^^
[Edited on 29-4-2017 by RKSoft]
|
|
CicTec
DIV Pro
Posts: 471
Registered: 6-8-2016
Member Is Offline
|
|
Hello RKSoft,
After removing all "hacks" to test your tutorial I noticed some logic errors in the instruction calls, I have corrected the PRG for it to work
according to the DIV execution logic, I did not encounter any problems running with the new version, you can confirm this when the new build comes
out.
Today I have finished the code re-format, I will try to correct the memory leak bug in the release version, so that the new build can be released,
another little of a patience.
Meanwhile your correct tutorial:
Attachment: jumpman.prg (32kB) This file has been downloaded 1736 times
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
Thx!!!
What did you changed in my code? I saw you remarked the variable "programm_continue" in that code. Is this all? oO If yes, well done and great work
when this run without problems.
|
|
CicTec
DIV Pro
Posts: 471
Registered: 6-8-2016
Member Is Offline
|
|
I have changed "setup_level" process from:
Code: |
process setup_level(stage)
private
temp;
begin
switch (stage)
case 1:
gfx_background = 100; gfx_hardmap = 300; gfx_screen = 200; start_scroll(0, file_screen, gfx_screen, gfx_background, 0, 4);
get_point(file_screen, gfx_screen, 1, &x, &y); player(x, y); /* Player */
scroll[0].x0 = x - 160; scroll[0].y0 = 0; scroll[0].x1 = scroll[0].x0; scroll[0].y1 = 0;
/*----------------------------------------*/
from temp = 2 to 16; get_point(file_screen, gfx_screen, temp, &x, &y); goomba(x, y); end /* Goomba */
get_point(file_screen, gfx_screen, 17, &x, &y); koopa(x, y); /* Koopa */
from temp = 18 to 30; get_point(file_screen, gfx_screen, temp, &x, &y); block_coin(x, y, 0); end /* Block: Coin */
get_point(file_screen, gfx_screen, 31, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
get_point(file_screen, gfx_screen, 32, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
from temp = 33 to 57; get_point(file_screen, gfx_screen, temp, &x, &y); coin(x, y); end /* Coin */
get_point(file_screen, gfx_screen, 59, &x, &y); goomba(x, y); /* Goomba */
from temp = 60 to 87; get_point(file_screen, gfx_screen, temp, &x, &y); block_crash(x, y, 0); end /* Block: Crashable */
get_point(file_screen, gfx_screen, 58, &x, &y); final(x, y); /* Final */
from temp = 88 to 94; get_point(file_screen, gfx_screen, temp, &x, &y); water(x, y); end /* Water */
end
default:
gfx_background = 100; gfx_hardmap = 300; gfx_screen = 200; start_scroll(0, file_screen, gfx_screen, gfx_background, 0, 4);
title(); /* Titlescreen */
scroll[0].x0 = 0; scroll[0].y0 = 0; scroll[0].x1 = 0; scroll[0].y1 = 0;
/*----------------------------------------*/
from temp = 2 to 16; get_point(file_screen, gfx_screen, temp, &x, &y); goomba(x, y); end /* Goomba */
get_point(file_screen, gfx_screen, 17, &x, &y); koopa(x, y); /* Koopa */
from temp = 18 to 30; get_point(file_screen, gfx_screen, temp, &x, &y); block_coin(x, y, 0); end /* Block: Coin */
get_point(file_screen, gfx_screen, 31, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
get_point(file_screen, gfx_screen, 32, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
from temp = 33 to 57; get_point(file_screen, gfx_screen, temp, &x, &y); coin(x, y); end /* Coin */
get_point(file_screen, gfx_screen, 59, &x, &y); goomba(x, y); /* Goomba */
from temp = 60 to 87; get_point(file_screen, gfx_screen, temp, &x, &y); block_crash(x, y, 0); end /* Block: Crashable */
get_point(file_screen, gfx_screen, 58, &x, &y); final(x, y); /* Final */
from temp = 88 to 94; get_point(file_screen, gfx_screen, temp, &x, &y); water(x, y); end /* Water */
end
end
stageSizeX = graphic_info(file_screen, gfx_screen, g_wide);
stageSizeY = graphic_info(file_screen, gfx_screen, g_height);
player_time = 399; game = true;
// program_continue = true;
end
|
to:
Code: |
process setup_level(stage)
private
temp;
begin
player_time = 399;
game = true;
switch (stage)
case 1:
gfx_background = 100; gfx_hardmap = 300; gfx_screen = 200; start_scroll(0, file_screen, gfx_screen, gfx_background, 0, 4);
get_point(file_screen, gfx_screen, 1, &x, &y); player(x, y); /* Player */
scroll[0].x0 = x - 160; scroll[0].y0 = 0; scroll[0].x1 = scroll[0].x0; scroll[0].y1 = 0;
/*----------------------------------------*/
from temp = 2 to 16; get_point(file_screen, gfx_screen, temp, &x, &y); goomba(x, y); end /* Goomba */
get_point(file_screen, gfx_screen, 17, &x, &y); koopa(x, y); /* Koopa */
from temp = 18 to 30; get_point(file_screen, gfx_screen, temp, &x, &y); block_coin(x, y, 0); end /* Block: Coin */
get_point(file_screen, gfx_screen, 31, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
get_point(file_screen, gfx_screen, 32, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
from temp = 33 to 57; get_point(file_screen, gfx_screen, temp, &x, &y); coin(x, y); end /* Coin */
get_point(file_screen, gfx_screen, 59, &x, &y); goomba(x, y); /* Goomba */
from temp = 60 to 87; get_point(file_screen, gfx_screen, temp, &x, &y); block_crash(x, y, 0); end /* Block: Crashable */
get_point(file_screen, gfx_screen, 58, &x, &y); final(x, y); /* Final */
from temp = 88 to 94; get_point(file_screen, gfx_screen, temp, &x, &y); water(x, y); end /* Water */
end
default:
gfx_background = 100; gfx_hardmap = 300; gfx_screen = 200; start_scroll(0, file_screen, gfx_screen, gfx_background, 0, 4);
stageSizeX = graphic_info(file_screen, gfx_screen, g_wide);
stageSizeY = graphic_info(file_screen, gfx_screen, g_height);
title(); /* Titlescreen */
scroll[0].x0 = 0; scroll[0].y0 = 0; scroll[0].x1 = 0; scroll[0].y1 = 0;
/*----------------------------------------*/
from temp = 2 to 16; get_point(file_screen, gfx_screen, temp, &x, &y); goomba(x, y); end /* Goomba */
get_point(file_screen, gfx_screen, 17, &x, &y); koopa(x, y); /* Koopa */
from temp = 18 to 30; get_point(file_screen, gfx_screen, temp, &x, &y); block_coin(x, y, 0); end /* Block: Coin */
get_point(file_screen, gfx_screen, 31, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
get_point(file_screen, gfx_screen, 32, &x, &y); block_crash(x, y, 2); /* Block: Crashable */
from temp = 33 to 57; get_point(file_screen, gfx_screen, temp, &x, &y); coin(x, y); end /* Coin */
get_point(file_screen, gfx_screen, 59, &x, &y); goomba(x, y); /* Goomba */
from temp = 60 to 87; get_point(file_screen, gfx_screen, temp, &x, &y); block_crash(x, y, 0); end /* Block: Crashable */
get_point(file_screen, gfx_screen, 58, &x, &y); final(x, y); /* Final */
from temp = 88 to 94; get_point(file_screen, gfx_screen, temp, &x, &y); water(x, y); end /* Water */
end
end
// program_continue = true;
end
|
This is because when process instances are created, they are executed immediately, in the case of the "goomba" and "koopa" processes, the "if (not
game) return; end" statement, and since "game" Is not yet set to TRUE, processes are destroyed instantly.
Also, the "title" process needs variables like "stageSizeX" that were initialized after creation, now everything is set before.
Beyond this small change the instructions of "hack" have been commented on.
|
|
RKSoft
Game Making Machine!
Posts: 232
Registered: 1-3-2016
Location: Germany
Member Is Offline
|
|
dang, my fail. I use graphic_info() in player process, not good. The stageSizeX and stageSizeY should do their work not only in the default SWITCH
. I rework the code again when you release the next nightly build (or next
official build?) and release it here...
But this cannot be the failure.
With your rework of DIV code i can remove the "hack" (ie: programm_continue etc.) completely?
Where was the bug in the DIV code?
[Edited on 6-5-2017 by RKSoft]
|
|
CicTec
DIV Pro
Posts: 471
Registered: 6-8-2016
Member Is Offline
|
|
Quote: Originally posted by RKSoft | dang, my fail. I use graphic_info() in player process, not good. The stageSizeX and stageSizeY should do their work not only in the default SWITCH
. I rework the code again when you release the next nightly build (or next
official build?) and release it here...
|
As you prefer
I think it's a nightly build, or maybe a new beta, this will see Mike when the new source code is over.
Quote: Originally posted by RKSoft |
But this cannot be the failure.
With your rework of DIV code i can remove the "hack" (ie: programm_continue etc.) completely?
|
For what I have tested, yes, you can remove it completely, however, wait for the new build to test it, so to confirm it's ok.
Hard to know the exact point, I had to make some changes to the original code to avoid conflicts with modern compilers, data type mismatching etc...,
have also been corrected many inside bugs of memory lieaks.
|
|
|