it's the same thing i think. some people can, some people can't. nothing to be ashamed of!
my advice would be to concentrate on making a nice easy to code game to start with, and then gradually as you make more games and learn more about DizzyAGE and how it works, you'll be able to make more sense of other peoples games, and will be able to see how they did things. This will help you learn more and it all helps to build your knowledge.
like anything in life, it isn't something you can start and expect to be able to understand everything about it straight away. Don't try to run before you've learned to walk properly!
gavlaa i don't think its just as simple as copying and pasting the code in, and theres not much point if you don't understand what it is your copying and pasting.. and in most cases you'll need to tweak theses code to suit your own game.
I have plans to add a Hydra to my next game.. several heads are better than one.. .lol
I think these advanced stuff is better off left to the tech demos than videos, that way you can study it better, and learn from it.
i had a look at the dragon coding in FWD ages ago, and yes it is incredibly complicated.
When i decided to put a dragon in IID i looked at FWD again, thinking that the intervening games may have made the code seem less complicated, but no, it was still quite complex, so i decided to code my own....
PLEASE BEAR IN MIND that this coding is for dragons facing right. if you want the dragon facing left, you will need to alter the 'flame' part of the coding.
firstly you'll need to copy tiles 6001, 6002 and 6003 out of the data->tiles->custom folder in IID.
then place in the map a body, 6 neck pieces, a head (use tile 6003, the one that moves), and a flame.
draw the dragon in the map, with 6 neck pieces. put all 8 (6 neck, 1 body, 1 head) as dynamic objects, with property ANIM = 0
Set user property 43 of the head as a few pixels greater than the Y position of the head. (e.g. Y position is 1147, set user property 43 to 1166). User property 43 determines where the head will move to next (so obviously if you draw the head close to the ground, you'll need to set this property to higher than the Y position).
Place a flame in the map, and set property DRAW to 0 (none) and property CLASS to 0 (none).
set IDs for them all, numbering them in sequential order, starting with the Body, then the neck parts from nearest the head down to nearest the body, then the head, then the flame. So for example:
Body ID = 1000
Neck part 1 ID (nearest the head) = 1001
Neck part 2 ID = 1002
Neck part 3 ID = 1003
Neck part 4 ID = 1004
Neck part 5 ID = 1005
Neck part 6 ID (nearest the body) = 1006
Head ID = 1007
Flame ID = 1008
Then set the COLLIDER properties of all of them to 1 (call handler), and set the CLASS properties of all of the body parts (not the flame) to 3 (kill)
Once you've done all that, the map part is complete.
For the coding, open gamedef.gs and put the following code in:
#def O_DRAGONPOS 43 // next position of dragon head
this defines user property 43 as O_DRAGONPOS
also put in:
#def G_DRAGONPAUSE 134 // pauses dragon head
this is a game variable to store if the dragons head is paused or not.
save that and open up game.gs, and put the following code in:
//////////////////////////////////////////////////////////
// Dragons movement
//
// body= ID of main body part (body id is first, then neck parts from head down to body, then head, then flame)
// toppos = highest y position of head
// bodypos = y position of the top of the body
// flameend = where the flame stops moving
//////////////////////////////////////////////////////////
func Move_Dragon(body,toppos,bodypos,flameend)
{
head = ObjFind(body+7);
if(!IsUpdate(ObjGet(head,O_DELAY))) return;
neck = tab(7);
necky = tab(7);
heady = ObjGet(head,O_Y);
nextpos = ObjGet(head,O_DRAGONPOS);
if(ObjGet(head,O_STATUS) < =2)
{
if(nextpos==heady)
{
opt = gs_rand(2);
if (opt==1) { ObjSet(head,O_STATUS,1); }
else { ObjSet(head,O_STATUS,2); }
ObjSet(head,O_DRAGONPOS,toppos+gs_rand(24));
nextpos = ObjGet(head,O_DRAGONPOS);
}
headx = ObjGet(head,O_ X) ;
}
//move head up
if(heady > nextpos&&ObjGet(head,O_STATUS)==0)
{
// cycle through neck parts
for(ni=1;ni < 7;ni++)
{
neck[ni]=ObjFind(body+ni);
necky[ni]=ObjGet(neck[ni],O_Y);
necky[ni]=bodypos+((heady+4-bodypos-2)/(ni));
ObjSet(neck[ni],O_Y,necky[ni]);
}
// set 1st neck part seperately
necky[1]=heady+4+((necky[2]-heady-4)/2);
ObjSet(neck[1],O_Y,necky[1]);
// set head part
heady=heady-1;
ObjSet(head,O_Y,heady);
return;
}
//move head down
if(heady < nextpos&&ObjGet(head,O_STATUS)==0)
{
// cycle through neck parts
for(ni=1;ni < 7;ni++)
{
neck[ni]=ObjFind(body+ni);
necky[ni]=ObjGet(neck[ni],O_Y);
necky[ni]=bodypos+((heady+4-bodypos+2)/(ni));
ObjSet(neck[ni],O_Y,necky[ni]);
}
// set 1st neck part seperately
necky[1]=heady+4+((necky[2]-heady-4)/2);
ObjSet(neck[1],O_Y,necky[1]);
// set head part
heady=heady+1;
ObjSet(head,O_Y,heady);
}
//stop moving and create flame
if(ObjGet(head,O_STATUS)==1)
{
flame = ObjFind(body+8);
if(!IsUpdate(ObjGet(flame,O_DELAY))) return;
if(ObjGet(flame,O_STATUS)==0)
{
ObjSet(head,O_FRAME,1);
ObjSet(flame,O_X,headx+16);
ObjSet(flame,O_Y,heady+8);
ObjSet(flame,O_CLASS,3);
ObjSet(flame,O_DISABLE,0);
ObjSet(flame,O_DRAW,3);
ObjSet(flame,O_STATUS,1);
}
if(ObjGet(flame,O_W) < 40&&ObjGet(flame,O_ X) < flameend-ObjGet(flame,O_W))
{
ObjSet(flame,O_W,ObjGet(flame,O_W)+8);
ObjPresent(flame);
}
else
{
if(ObjGet(flame,O_ X) > =flameend-ObjGet(flame,O_W))
{
ObjSet(flame,O_W,ObjGet(flame,O_W)-8);
if(ObjGet(flame,O_W) < =0)
{
ObjSet(head,O_FRAME,0);
ObjSet(flame,O_CLASS,0);
ObjSet(flame,O_DISABLE,1);
ObjSet(flame,O_DRAW,0);
ObjSet(head,O_STATUS,0);
ObjSet(flame,O_STATUS,0);
}
}
ObjSet(flame,O_X,ObjGet(flame,O_ X) +8);
ObjPresent(flame);
}
}
//stop moving but don't create flame
if(ObjGet(head,O_STATUS)==2)
{
dp = GameGet(G_DRAGONPAUSE);
dp = dp+1;
GameSet(G_DRAGONPAUSE,dp);
if(dp>=10)
{
GameSet(G_DRAGONPAUSE,0);
ObjSet(head,O_STATUS,0);
}
}
//if dragon put to sleep
if(ObjGet(head,O_STATUS)==3&&heady < bodypos+7)
{
flame = ObjFind(body+8);
ObjSet(flame,O_DISABLE,1);
ObjSet(flame,O_DRAW,0);
ObjSet(flame,O_STATUS,0);
ObjSet(head,O_FRAME,0);
// cycle through neck parts
for(ni=1;ni < 7;ni++)
{
neck[ni]=ObjFind(body+ni);
necky[ni]=ObjGet(neck[ni],O_Y);
necky[ni]=bodypos+((heady+4-bodypos+2)/(ni));
ObjSet(neck[ni],O_Y,necky[ni]);
}
// set 1st neck part seperately
necky[1]=heady+4+((necky[2]-heady-4)/2);
ObjSet(neck[1],O_Y,necky[1]);
// set head part
heady=heady+1;
ObjSet(head,O_Y,heady);
if(heady==bodypos+7)
{
for(ni=1;ni < 7;ni++)
{
ObjSet(neck[ni],O_CLASS,0);
}
ObjSet(head,O_CLASS,0);
bodyidx = ObjFind(body);
ObjSet(bodyidx,O_CLASS,0);
}
}
}
this is the entire code that deals with moving the dragon, setting the flame position, and moving his head down once placated.
to get him to move, you need to find the room X and Y numbers that the dragon is in from the map, and use the following code also in game.gs:
func UpdateRoom_RX_RY()
{
Move_Dragon(BODY,TOPPOS,BODYPOS,FLAMEEND);
}
where:
RX is the room X position of the dragon
RY is the room Y position of the dragon
BODY is the ID of the dragon body
TOPPOS is the highest Y position that you want the head to go up to
BODYPOS is the Y position of the body +10 (e.g if body Y position is 1151, BODYPOS would be 1161)
FLAMEEND is the X position in the map that you want the flame to end.
to placate the dragon, use this code:
head = ObjFind(HEADID);
ObjSet(head,O_STATUS,3);
for(i=BODYID;i < FLAMEID;i++)
{
idx = ObjFind(i);
ObjSet(idx,O_CLASS,0);
ObjSet(idx,O_COLLIDER,0);
}
where:
HEADID is the ID of the head
BODYID is the ID of the body
FLAMEID is the ID of the flame
there. that's it. simple eh?! :tongue:
PLEASE don't complain if it isn't working for you, as everything to work it is set out above, and tbh, if you're only just starting with dizzyage it's probably far too complex for you, and i'd seriously advise you to just stick with the basics for now!
hehe it’s ok Annie! i think you have to have a certain way of thinking to be able to code things easily. :smile: just like you need a fairly artistic mind to be able to paint well (i cannot paint to save my life!)
it’s the same thing i think. some people can, some people can’t. nothing to be ashamed of!
[/quote]very understanding of u jamie ta very - i get what u mean and i just don't think i'm gonna get the hang of it will still try though - now typing i can do my speeds for that are around 84wpm and as for painting same as u not to save my life - its a great thread though hope all your hard work is appreciated and we see some more games in next years competition {yolkfolk}:clap:
Uggghhh . . .
I can't wait til I understand what he is talking about. :x_x:
Getting better, though! :smile:
Anyway, there are a number of things I still dont know how to do to enable me to complete a game if/whenever I get to that point, these being:-
1. How to do under water play (this is more of a like to know at the moment), as ive not included into the game and may not anyway.
2. How do you when youve collected all collectables, say x quantity and you give to y character to take the counter down to 0 as youve now handed them over & thus completing that part of the game so you can progress.
3. How do you say enter like a gate entrance of one screen and that takes you like inside (ie moves you to another part of the map covering the inside, until you exit and you appear back where you originally entered)
4. How to actually end the game when all collectibles and all puzzles completed where it takes you to say a 'game completed' screen where all the yolkfok have gathered (preferably with different music to signify youve completed)
5. How to apply music files for certain sections (rooms) of the games when you enter/exit, I have some midi files, but I know you cant use that type, need to be ogg or wav, I managed to get a conversion application but the files for WAV become far too big for a dizzy game. Any advice, I have a main piece of music for the game, but cant find a way of applying it.
Im happy so far with the progress ive made however & when I feel im getting further with it I may post such progress. The testing of the puzzles takes the time and the further of the game you complete the more time it takes to get there to test again. Im actually putting the item required infront of the puzzle to quicken the test and making shortcuts to get to that area. Also I will eventually have to start working out a sequence which is going to be an art in itself lol. Again if there are any tips on 'quickening' the testing that be great.
Im happy so far with the progress ive made however & when I feel im getting further with it I may post such progress. The testing of the puzzles takes the time and the further of the game you complete the more time it takes to get there to test again. Im actually putting the item required infront of the puzzle to quicken the test and making shortcuts to get to that area. Also I will eventually have to start working out a sequence which is going to be an art in itself lol. Again if there are any tips on ‘quickening’ the testing that be great.
[/quote]i'll go through the rest a bit later on, but i'll just deal with this bit first.
you can use 'dev mode' to easily skip to where you need to be for testing. ensure that dev=1 in the 'advanced' part of dizzy.ini, then when you're in the game, hold CTRL or SHIFT while moving to move dizzy around the map. This will help you to move around quicker and get past puzzles without completing them! :smile: don't worry though, i was the same. i had about 8 different 'start' points in DMD for when i was wanting to test stuff in different places!EDITS: Yes, that gonna make things much easier
Put all the puzzle items into the same room, and make dizzy start in that room. load- test. and if it works visit the map editor and move the items into the correct sport.
and then do it again for another puzzle.. changing dizzys start position each time and moving the items to were they are meant to be.
OR. set up a test room somewere on the map and have dizzy start there and test the puzzles.. you can then move them to were they are meant to go afterwards. i mean a door doesn't need to be in the finish spot to test it, and you can move objects around.. unless the object needed is gotten from another puzzle first in which case make sure its not disabled, if it works make you can just disable it again and re-positioning it.
Its far quicker than running though the whole game, and hunting down all the items..
As for water play.. have you downloaded the tech demo???
[quote data-userid="50" data-postid="65395"]
1. How to do under water play (this is more of a like to know at the moment), as ive not included into the game and may not anyway.
[/quote]
Put down a big static brush in the map covering everywhere that water is (you may need two or more). Set the MAT property to WATER, and the DRAW property to MAT.
in gamedef.gs, change the following line:
#def SUPPORT_WATERPLAY 0
to
#def SUPPORT_WATERPLAY 1
and if you have scuba and flipper items, change the -1 in the following code to the relevent item ID numbers:
#def ID_SCUBA -1 #def ID_FLIPPERS -1
for example if scuba is 1000 and flippers are 1001, change it as follows:
#def ID_SCUBA 1000 #def ID_FLIPPERS 1001
[quote data-userid="50" data-postid="65395"]
2. How do you when youve collected all collectables, say x quantity and you give to y character to take the counter down to 0 as youve now handed them over & thus completing that part of the game so you can progress.
[/quote]
this is the main gist of the code. The first line tests if you have collected them all, and the third line resets them to 0. Of course you don't have to use them together like this, and chances are that you probably won't.
if(PlayerGet(P_COINS)==MAXCOINS)
{
PlayerSet(P_COINS,0);
}
[quote data-userid="50" data-postid="65395"]
3. How do you say enter like a gate entrance of one screen and that takes you like inside (ie moves you to another part of the map covering the inside, until you exit and you appear back where you originally entered)
[/quote]
use PlayerSetPos(PX,PY); to move the player, where PX is the new X position and PY is the new Y position. i think i've shown in one of the later videos how to use dev mode to find an accurate position for the player (i.e. not in the middle of ground!)
Regarding moving him when you exit a room, try the following. this assumes you want to move him when he exits at the right hand side of the room:
func CloseRoom_RX_RY() // RX and RY are the room number co-ordinates
{
playx = PlayerGet(P_ X) ;
if(playx>=XPOS) // check if player is near the right-hand edge of the room
{
PlayerSetPos(PX,PY); // move player
}
}
where:
RX and RY are the room co-ordinates
XPOS is a position in the map fairly close to the right hand edge of the room
PX and PY are the new player X and Y co-ordinates in the map.
i'll go through 4 and 5 later
regarding question 4 (ending the game), all you need to do is use PlayerSetPos(PX,PY); to move him into another screen once you've finished the game, then do messages etc to tie up loose ends and all that. Once everything is done, use the following code to pull up the end game menu:
OpenDialogFinish();
as for question 5, changing the music, that's slightly more complicated. all the music is stored in the folder 'Music' and is named with a number, then a space, then a name. E.G. 4 new_music.ym
once you've added one or two new pieces of music (try to use ones that loop without people noticing), go into the sound.gs file and you'll see where the game defines the music files:
#def MUSIC_NONE -1 #def MUSIC_A 1 #def MUSIC_B 2 #def MUSIC_C 3
all you need to do is add to this, e.g.:
#def MAIN_MUSIC 4
you can call it pretty much anything you want. just make sure that the number is the same as the number you put in the filename of the music file. You can't duplicate numbers either. The name of the music file doesn't have to be the same as what you define it as in the code, but if it's similar it can help avoid confusion!
then all you need to do is use the following bit of code to change the music:
MusicFade(1,0); // set music fade options MusicPlay(MAIN_MUSIC); // play default music
the first line of code fades the music out, and then in (not needed, but is nice, as it stops it suddenly changing) - play around with the two numbers to see the effect it has. The second line sets the new music to be played.
You can use this code virtually anywhere, in functions, after you've changed the players position using PlayerSetPos(PX,PY); (this is useful when ending the game), or you can also use it when opening a new room, as so:
func OpenRoom_RX_RY() // RX and RY are the room number co-ordinates
{
MusicFade(1,0); // set music fade options
MusicPlay(MAIN_MUSIC); // play default music
}
I usually use colliders to change the music, but either way works fine.