Jump to content
Nokioteca Forum

How to create a game in this language?


Nalcwap
 Share

Recommended Posts

Hi my name is nalcwap im portuguese sorry my bad english i want create a game type mario with mshell but i not how to start can you help me one example in english i see one example but not english is italiane :( name pacman but i not understand the basis of the game script i want make levels with array type level1=[0,0,0,1,0,2,,0,0,3],[0,0,0,0,0,0,0,0,0]] where 0=null 1=mario 2=enemy 3=wall but i m a newbie in programation can you make the first level example with easy code for i understand in english code please and thanks for this i love i understand how make games and with mshell is more easy ,please not utilize classes why is more dificulty i understand

Please LENTO can you help me?where to start?or anyone can help me please?im a newbie i not understand the basis of array for the game

How to make the collision in array for the wall?

Modificato da Il.Socio
Link to comment
Condividi su altri siti

I'm sorry .. I can not help

I only know Italian.

:(

This is bad these days :D

Jokes apart, to create a game you need firstly to think about what putting inside. I mean, the game logic, what is going to do, how to implement images/controls/.. etc.. Thus, firstly you need to know in a fine way the language you're using. Then you can begin to define structures as you said. But I suggest you to use classes (objects, I don't know in mShell how are them implemented) and not array.

An object example would be (this is only the logic/pseudo code)

object (class) Mario:

positionX = ...

positionY = ...

isSuper = true

function Jump:

positionX += 10

...

function run:

speed += 12

and so on ;)

Hope I helped you a bit...Have a nice daY!

Link to comment
Condividi su altri siti

Thanks lento but i need known without classes and how the game you make pacman work easy understand

Type how you start the pacman game and how start the collision in arry wall=[[0,0,0,1,0,2],[2,2,2,2,2,2]] where 0=null 1=packman 2=wall i love he game you make pacman and the collision you make and i want create a mario game with this collision thanks lento

Ups thanks lento e memory but lento can you make example in italian ?i will translate with google its not easy and memory thanks buddie but is more easy for me understant array not classes

Or MEMORY can you explain in classes easy where the objects stay in a array type the example i give sorry my bad english im portuguese can you make an example working with mario and walls type the array i give thanks/p.s the classes i known very very bad

Modificato da Darkangel
Link to comment
Condividi su altri siti

Or MEMORY can you explain in classes easy where the objects stay in a array type the example i give sorry my bad english im portuguese can you make an example working with mario and walls type the array i give thanks/p.s the classes i known very very bad

oops...I was too techy ;)

OK, so, indeed if you want to avoid classes you can use array to draw objects.

An example could be the game "area" (using the yellow eater-ball as example :D)

So an array having these coordinates could be used as is, no for/while are necessary as the drawing function (point, line, rectangles..) should accept point-point-... array like [(first point), (second point...)]

For the collisions, just create some if conditionals in the main loop of the game (the function/class that redraws game screen after X seconds, usually like 1/25 seconds, to have more or less 25 fps, let's say every 0.2 seconds). If you don't have this loop (everything is static until a key is pressed), it's the same!

For example you can fill a "collision" array and then in a for you can check if the main character (let's say Mario hihi) is into this bounds or out!

This needs a bit of thinking on how implementing it, we cannot help you more. The code must be written by yourself, but we are proud to help you, as in a forum should be ;)

PS: I don't know the lento's game, but the logic should be this!

PS2: I used to program with python, but same as before, the logic is the same ;)

Link to comment
Condividi su altri siti

Thanks memory but i need anyone explain the collision how work in the example array i give ho work?how check if collide?

Please lento can you explain your code more detailed please?

Please fix this

use graph as g,ui,audio, math;

g.size(240,320);

mario=g.icon("e:\\images\\mario1.png",0x000000); // 21x34

wall=g.icon("e:\\documents\\mshell\\x.png",0x000000);

g.size(mario,30,30);

g.size(wall,30,30);

a=3;b=5;

vazio=0

mario=1

wall=2

function level(n)

if n=0 then

return [[0,0,2,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,1,0,0,0,0,2],

[2,2,2,2,2,2,0,2],

[0,0,0,0,0,0,0,2],

[2,0,2,0,2,2,2,2],

[2,2,2,2,2,2,2,2]]

end

end

Modificato da Darkangel
Link to comment
Condividi su altri siti

Ok lento thanks

mi dispiace, non sono in grado di aiutarti.

Ho abbandonato la piattaforma Symbian

Non posseggo piu un cellulare Nokia e

da troppo tempo non utilizzo mShell.

I programmi sono sufficentemente documentati.

Sia nei sorgenti che dai commenti nel forum.

Se qualche frase non ti è chiara chiedi nel forum se qualcuno

te la può tradurre in Inglese corretto.

I'm sorry, I'm not able to help.

I abandoned Symbian platform

I do not have a Nokia mobile phone and more

mShell unused for too long.

The programs are sufficiently documented.

In both sources that the comments in the forum.

If you do not understand some phrases in the forum if you ask someone

You can translate into the English corrected.

Link to comment
Condividi su altri siti

function level(n)

if n=0 then

return [[0,0,2,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,1,0,0,0,0,2],

[2,2,2,2,2,2,0,2],

[0,0,0,0,0,0,0,2],

[2,0,2,0,2,2,2,2],

[2,2,2,2,2,2,2,2]]

end

end

level(n) // rende una matrice bidimensionale

canvas = level(0) // crea la matrice canvas con lo scenario che hai disegnato in level(0)

// canvas ti serve per disegnare lo scenario

// questa matrice canvas ti serve per sapere se la casella dove Mario vuole andare è accessibile (0)

// oppure se è un muro (2)

a=canvas[0][2] // a = 2 muro Mario non puo avanzare in quella direzione

a=canvas[1][1] // a = 0 Mario puo avanzare in quella direzione.

// tutto qui quello che ti serve per leggere le collisioni

:shifty:

Modificato da lento
Link to comment
Condividi su altri siti

use graph as g,ui,audio, math;

g.size(240,320);

mario=g.icon("e:\\images\\mario1.png",0x000000); // 21x34

wall=g.icon("e:\\documents\\mshell\\x.png",0x000000);

g.size(mario,30,30);

g.size(wall,30,30);

a=3;b=5;

vazio=0
mario=1
wall=2

// 1° alternativa
// se vuoi usare vari scenari o livelli usa questo
function level(n)
 if n=0 then
 		return [
         [0,0,2,0,0,0,0,2],
         [2,0,0,0,0,0,0,2],
         [2,0,0,0,0,0,0,2],
         [2,0,1,0,0,0,0,2],
         [2,2,2,2,2,2,0,2],
         [0,0,0,0,0,0,0,2],
         [2,0,2,0,2,2,2,2],
         [2,2,2,2,2,2,2,2]]
 elsif n=1 then
 		return [
 	  [0,0,2,0,0,2,0,2],
         [2,0,0,0,0,0,0,2],
         [2,0,0,0,0,0,0,2],
         [2,0,1,0,0,0,0,2],
         [2,0,2,2,2,2,0,2],
         [0,0,0,0,0,0,0,2],
         [2,0,0,0,0,0,0,2],
         [2,2,2,2,2,2,2,2]]  
 end
end

canvas = level(0);
// 2° alternativa
// se ti basta un solo scenario puoi fare così
canvas = [
         [0,0,2,0,0,0,0,2],
         [2,0,0,0,0,0,0,2],
         [2,0,0,0,0,0,0,2],
         [2,0,1,0,0,0,0,2],
         [2,2,2,2,2,2,0,2],
         [0,0,0,0,0,0,0,2],
         [2,0,2,0,2,2,2,2],
         [2,2,2,2,2,2,2,2]
        ];

function collision(x,y)
if canvas[x][y]=2 then
  return true   // collisione
end
return false  // libero di muoversi
end

pxMario=0;  // posizione x di mario
pyMario=1;  // posizione y di mario

// mario vuole andare in x=0 y=2 
// verifica se quella posizione è possibile

if collision(pxMario,pyMario+1)=false then   // x=0 y=2
// muovi mario!
else
       // mario non puo muoversi
end

Modificato da lento
Link to comment
Condividi su altri siti

use graph as g,ui,audio, math;

g.size(240,320);

mario=g.icon("e:\\images\\mario1.png",0x000000); // 21x34

wall=g.icon("e:\\documents\\mshell\\x.png",0x000000);

g.size(mario,30,30);

g.size(wall,30,30);

a=3;b=5;

vazio=0

mario=1

wall=2

// 2 alternativa

// se ti basta un solo scenario puoi fare cosi

canvas = [[0,0,2,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,1,0,0,0,0,2],

[2,2,2,2,2,2,0,2],

[0,0,0,0,0,0,0,2],

[2,0,2,0,2,2,2,2],

[2,2,2,2,2,2,2,2]];

function collision(x,y)

if canvas[x][y]=2 //<give error

then return true // collisione

end

return false // libero di muoversi

end

pxMario=0; // posizione x di mario

pyMario=1; // posizione y di mario

// mario vuole andare in x=0

y=2 // verifica se quella posizione e possibile

if collision(pxMario,pyMario+1)=false

then // x=0 y=2

// muovi mario!

else // mario non puo muoversi

end

this line give error: if canvas[x][y]=2

'No such local variable or field' why?

Link to comment
Condividi su altri siti

Ooops! scusami dimenticavo come si usa mShell! :sick:

Per le variabili globali ci vuole il punto (.canvas) quando sono all'interno di funzioni.

Modifica questa parte da:

function collision(x,y)
       if canvas[x][y]=2 then
         return true   // collisione
       end
       return false  // libero di muoversi
end

in:

function collision(x,y)
       if .canvas[x][y]=2 then
         return true   // collisione
       end;
       return false  // libero di muoversi
end

Ricordati anche il ; dopo end

Link to comment
Condividi su altri siti

Ah thanks lento buddie ;) you are the best for create games i love games i love study programming games in mshell is more easy then python but im a very very newbie in programming lol and im bad english but i know you can help me you are great i love mshell plataforn for easy understand but i not know make games and i loved your help for i understand i very bad understand sorry for that and thanks you help in create the game is my dream create games i not have pc and my n96 tel with mshell help become my dream true and with your help i will realise my dream very thanks buddy i have very questions in create the game and i know you can helpme in italian but if the script is detailead is more easy and thanks to you i will make more easy sorry my bad dificulty in programming if you can helpe i thank you i loved your packman game and i with make games good to your pacman game i love the array for put the objects and all im very bad in understand and love creating but im dificult in this thanks for explain this to me you are the best 'teacher' for this thanks buddie

Link to comment
Condividi su altri siti

Can you explain please you put code working show the images and utilize the game images and collision function collide work for complete the script for the rest i will make a conter level n=0 and n++ for n=0;n=1 n=2 for more levels but i need help first in put images showing now and put the collide function work with images thanks lento i very great with your help help me realize my dream make games come true sorry all the questions buddie but you wake my esperance for make my dream true and the equipe mshell create the mshell app for easy programming if i put game in net i will give you credits for your help i dont know if i put in net but if i put i give thanks in credits buddie you help very thanks for helpme

Link to comment
Condividi su altri siti

The code(is best more levels n=0,n=1);

use graph as g,ui,audio, math;

g.size(240,320);

mario=g.icon("e:\\images\\mario1.png",0x000000); // 21x34

wall=g.icon("e:\\documents\\mshell\\x.png",0x000000);

g.size(mario,30,30);

g.size(wall,30,30);

a=3;b=5;

vazio=0

mario=1

wall=2

n=0

// 1z alternativa

// se vuoi usare vari scenari o livelli usa questo

function level(n)

if n=0 then return [[0,0,2,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,1,0,0,0,0,2],

[2,2,2,2,2,2,0,2],

[0,0,0,0,0,0,0,2],

[2,0,2,0,2,2,2,2],

[2,2,2,2,2,2,2,2]] ;

elsif n=1 then return [[0,0,2,0,0,2,0,2], [2,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,1,0,0,0,0,2],

[2,0,2,2,2,2,0,2],

[0,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,2,2,2,2,2,2,2]];

end;

end;

canvas = level(0);

// 2z alternativa

// se ti basta un solo scenario puoi fare cosi

canvas = [[0,0,2,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,0,0,0,0,0,2],

[2,0,1,0,0,0,0,2],

[2,2,2,2,2,2,0,2],

[0,0,0,0,0,0,0,2],

[2,0,2,0,2,2,2,2],

[2,2,2,2,2,2,2,2]];

function collision(x,y)

if .canvas[x][y]=2

then return true // collisione

end;

return false // libero di muoversi

end;

pxMario=0; // posizione x di mario

pyMario=1; // posizione y di mario

// mario vuole andare in x=0

y=2 // verifica se quella posizione e possibile

if collision(pxMario,pyMario+1)=false

then // x=0 y=2

// muovi mario!

else // mario non puo muoversi

end

if n is more levels the example canvas altere? Or is equal? Sorry for all questions

Link to comment
Condividi su altri siti

Troverai risposta in:

https://www.nokioteca.net/home/forum/index.php/topic/172833-divertiamoci-a-creare-pacman/

nel file pacd02.txt

https://www.nokioteca.net/home/forum/index.php/topic/172833-divertiamoci-a-creare-pacman/page__view__findpost__p__1452544

Qui trovi una versione semplificata di pacman

https://www.nokioteca.net/home/forum/index.php/topic/172833-divertiamoci-a-creare-pacman/page__view__findpost__p__1457794

Contiene tutto quello che ti serve per capire il gioco senza complicazioni aggiunte.

Studiati il file "esempio.txt"

https://www.nokioteca.net/home/forum/index.php?app=core&module=attach&section=attach&attach_id=30846

Altre spiegazioni per quanto mi chiedi si trovano nei vari esempi del forum.

Modificato da lento
Link to comment
Condividi su altri siti

Sorry i have 2 question i not understand in pacman esempio.m are:

first:how you calculate this line>if pag[oy/10][ox/10] = 2 then g.put(ox,oy,piasMuro); else g.put(ox,oy,piasVuota); end;

the part pag[oy/10 how you see and calculate this /10 why and the second question is:

if pag[y/10][(x-10)/10]=0 then ox=x; oy=y; x=x-10; end;// sposta a sinistra pac

the x-10)/10 and why ox=x oy=y x=x-10?i not understand how you calculate this / and - sorry for questions and thanks

Link to comment
Condividi su altri siti

One more question please:if i utilize .png images will slow game?if yes how make the mario transparent for see background between the legs with images i know how to make transparent but slow if example images you give not show transparence between the mouth of packman /please respond this and the 2 questions up i give please thanks

Link to comment
Condividi su altri siti

I not understand in pacman esempio.m are:

-first:how you calculate this line>if pag[oy/10][ox/10] = 2 then g.put(ox,oy,piasMuro); else g.put(ox,oy,piasVuota); end;

the part pag[oy/10 how you see and calculate this /10 
- second question is:

if pag[y/10][(x-10)/10]=0 then ox=x; oy=y; x=x-10; end;// spostaa sinistra pac

the x-10)/10 and why ox=x oy=y x=x-10?i not understand how you calculate this / and - 
-third question:if i utilize .png images will slow game?
-fourth question: if yes how make the mario transparent for see background between the legs with images i know how to make transparent but slow if example images you give not show transparence between the mouth of packman 
sorry for questions and thanks

Link to comment
Condividi su altri siti

One more question please:if i utilize .png images will slow game?if yes how make the mario transparent for see background between the legs with images i know how to make transparent but slow if example images you give not show transparence between the mouth of packman /please respond this and the 2 questions up i give please thanks

Please read Mshell Library V.3.07 graph.icon

Link to comment
Condividi su altri siti

Please sign in to comment

You will be able to leave a comment after signing in



Accedi Ora
 Share

×
×
  • Crea Nuovo...

Informazione Importante

Questo sito utilizza i cookie per analisi, contenuti personalizzati e pubblicità. Continuando la navigazione, accetti l'utilizzo dei cookie da parte nostra | Privacy Policy