Questions of a beginner

Learn how to start making games.

Re: Questions of a beginner

Postby ITomi » Thu Nov 24, 2016 8:23 am

Hello Lcl!
The drawing of lives seems to be good, but the movement is weak, because the player and the enemeis can go into walls.
But I attach the game. (It is a small pac-man clone I make to my nephew.)
Attachments
zozohami.zip
(463.91 KiB) Downloaded 99 times
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby ITomi » Fri Dec 23, 2016 2:20 pm

Where is the origin of an actor in GE? In the middle of it or in its left-top corner?
And how can I make an invisible bounding box around the actors for the collisions?
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby ITomi » Mon Feb 20, 2017 2:50 pm

How can I use the variables and (two dimensional) arrays from Global Code?
I declared these in the Global Code Editor (e.g.: myVar=10), but I can't access to these from the Script Editor of the actors: e.g.: myVar is always equal to 0, if I try to write out from other Script Editors.
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby ITomi » Tue Feb 21, 2017 2:28 pm

I almost done with my program, but I found a big problem again:
I put out the elements of the game with the following code:
Code: Select all
int i,j,xplace,yplace;
char level1[20][30] =
{
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,1,0,0,0,0,0,1,0,0,0,0,0,1},
{0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1},
{0,0,0,0,0,1,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1},
{0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1},
{0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1},
{0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0},
{1,1,1,1,1,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0},
{1,2,1,1,0,3,0,0,4,1,0,1,1,0,0,1,1,0,0,0,4,0,0,1,0,1,0,0,0,0},
{1,0,1,1,0,1,1,1,0,1,0,0,1,1,0,1,1,0,1,1,1,1,0,1,0,1,1,0,0,0},
{1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,1,0,0,0},
{1,1,1,1,1,1,0,1,0,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,0,1,0,0,0},
{0,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,4,1,0,0,0},
{1,1,1,1,1,1,0,1,1,0,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,0,1,0,0,0},
{1,0,0,0,0,0,0,1,1,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
{1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1},
{1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1},
};
//
xplace=0;
yplace=0;
walls=0;
for(j = 0; j < 20; j++)
{
  for(i=0; i < 30; i++)
  {
      switch (level1[j][i])
      {
          case 1: CreateActor("wall", "wall", "no parent", "no path",xplace,yplace,true);
                  placeofwall[walls][0]=xplace;
                  placeofwall[walls][1]=yplace;
                  walls+=1;
          break;
          case 2: CreateActor("teleport", "teleport", "no parent", "no path",xplace,yplace,true); break;
          case 3: CreateActor("ghost", "ghost0", "no parent", "no path",xplace,yplace,true); break;
          case 4: CreateActor("dot", "dot", "no parent", "no path",xplace,yplace,true); break;
      };
      xplace+=wall.width;
  };
  xplace=0;
  yplace+=wall.height;
};

Everything are on their place, so everything OK. But when I try to place other things on the coordinates of the walls, these things will be on totally different places, however I have saved their coordinates into placeofwall arrays. To see it, I placing these things with the following code:
Code: Select all
for (i=0;i<walls;i+=1)
{
  CreateActor("dot", "dot", "no parent", "no path",placeofwall[i][0],placeofwall[i][1],true);
}

But it is not good; the dots appears on wrong coordinates! What is the problem and how can I solve this?
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby juansimat » Tue Feb 21, 2017 6:43 pm

ITomi wrote:I almost done with my program, but I found a big problem again:
I put out the elements of the game with the following code:
Code: Select all
int i,j,xplace,yplace;
char level1[20][30] =
{
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,1,0,0,0,0,0,1,0,0,0,0,0,1},
{0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1},
{0,0,0,0,0,1,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1},
{0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1},
{0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1},
{0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0},
{1,1,1,1,1,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0},
{1,2,1,1,0,3,0,0,4,1,0,1,1,0,0,1,1,0,0,0,4,0,0,1,0,1,0,0,0,0},
{1,0,1,1,0,1,1,1,0,1,0,0,1,1,0,1,1,0,1,1,1,1,0,1,0,1,1,0,0,0},
{1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,1,0,0,0},
{1,1,1,1,1,1,0,1,0,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,0,1,0,0,0},
{0,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,4,1,0,0,0},
{1,1,1,1,1,1,0,1,1,0,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,0,1,0,0,0},
{1,0,0,0,0,0,0,1,1,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
{1,0,1,1,1,1,0,1,1,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1},
{1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1},
};
//
xplace=0;
yplace=0;
walls=0;
for(j = 0; j < 20; j++)
{
  for(i=0; i < 30; i++)
  {
      switch (level1[j][i])
      {
          case 1: CreateActor("wall", "wall", "no parent", "no path",xplace,yplace,true);
                  placeofwall[walls][0]=xplace;
                  placeofwall[walls][1]=yplace;
                  walls+=1;
          break;
          case 2: CreateActor("teleport", "teleport", "no parent", "no path",xplace,yplace,true); break;
          case 3: CreateActor("ghost", "ghost0", "no parent", "no path",xplace,yplace,true); break;
          case 4: CreateActor("dot", "dot", "no parent", "no path",xplace,yplace,true); break;
      };
      xplace+=wall.width;
  };
  xplace=0;
  yplace+=wall.height;
};

Everything are on their place, so everything OK. But when I try to place other things on the coordinates of the walls, these things will be on totally different places, however I have saved their coordinates into placeofwall arrays. To see it, I placing these things with the following code:
Code: Select all
for (i=0;i<walls;i+=1)
{
  CreateActor("dot", "dot", "no parent", "no path",placeofwall[i][0],placeofwall[i][1],true);
}

But it is not good; the dots appears on wrong coordinates! What is the problem and how can I solve this?



Can you explain what you are trying to achieve? Maybe they are not wrong coords but instead they appear flipped or transmuted
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score

Re: Questions of a beginner

Postby ITomi » Wed Feb 22, 2017 12:52 pm

Hello Juansimat!

I have saved the coordinates of the walls into an array. Then the ghosts checks whether collided with this coordinates. But the ghosts moving at random ways, not along the walls. Then I realized that the coordinates in the array are not the same as the coordinates of the walls, therefore I made there dots to make visible the difference.
But I attach the source of the game (Hungarian code). In this, the dots should be on same coordinates like the walls.
Attachments
zozohami2.zip
(1.22 MiB) Downloaded 105 times
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby juansimat » Wed Feb 22, 2017 1:01 pm

I'm still reading the code. But found an issue:
You define in global code:
Code: Select all
int falhely[600][1];


and in other scripts you reference it as:
Code: Select all
falhely[falhelydb][0]=xhely;
falhely[falhelydb][1]=yhely;


The problem is that falhely's dimension is 600x1, and you are accesing it like a 600x2. I changed the falhely[600][1] in the global script with falhely[600][2] and the dots are now in the walls.
Try to make that change and tell us if there is another problem
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score

Re: Questions of a beginner

Postby ITomi » Wed Feb 22, 2017 1:09 pm

Wow, thanks, Juansimat! :D
I thought that "1" means the two array values (0 and 1). :oops:
I hope, finally I will be able to make my first GE game.
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby lcl » Wed Feb 22, 2017 1:15 pm

ITomi wrote:I hope, finally I will be able to make my first GE game.

Good luck with the project, make sure to show it on the forums once you get it done, I'd love to get to play new GE-made games! :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Questions of a beginner

Postby juansimat » Wed Feb 22, 2017 1:16 pm

No problem. Föl a fejjel!
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score

Re: Questions of a beginner

Postby ITomi » Wed Feb 22, 2017 1:21 pm

Thank you, everybody!
As soon as I will done with my game, I will publish it.
And: köszönöm a biztatást! :D
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby lcl » Wed Feb 22, 2017 2:21 pm

ITomi wrote:Thank you, everybody!
As soon as I will done with my game, I will publish it.
And: köszönöm a biztatást! :D

Hey, Hungarian! I've been to Budapest twice :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Questions of a beginner

Postby ITomi » Wed Feb 22, 2017 3:22 pm

lcl wrote:Hey, Hungarian! I've been to Budapest twice :D

Did you like my capital? I live there for 5 years.
And my older brother have been to Finland, about 20 years ago. Beautiful country!
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

Re: Questions of a beginner

Postby lcl » Wed Feb 22, 2017 5:33 pm

ITomi wrote:
lcl wrote:Hey, Hungarian! I've been to Budapest twice :D

Did you like my capital? I live there for 5 years.
And my older brother have been to Finland, about 20 years ago. Beautiful country!

Yes, I did like Budapest quite a lot! That's why I returned there a few years after I had first been there. I especially loved the old metros, the language and the views, that city is so beautiful. The second time I also visited Margaret Island, such a pretty place! :) Also the ruin pubs are so atmospheric, I enjoyed drinking a coke at one. Your capital is one of my favorite places I've visited so far! And wow, that's a funny coincidence that your brother has visited Finland! :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Questions of a beginner

Postby ITomi » Thu Feb 23, 2017 3:34 pm

Now I making the levels of the game. Two levels are done. But there is a little problem again: when I added the second level, the first wall-line of the first level are moved to the left with 15, and I don't know, why? Something wrong with my for statements in the Global Code "pstart"? I attached the file: it is already playable (you have to collect the dots and return to the teleport to jump to the next level), but at the first level the labirinth is holed above.
Attachments
zh.zip
(1.19 MiB) Downloaded 88 times
User avatar
ITomi
 
Posts: 48
Joined: Sun Aug 21, 2016 1:56 pm
Location: Hungary
Score: 5 Give a positive score

PreviousNext

Return to Getting Started

Who is online

Users browsing this forum: No registered users and 1 guest