Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - sf-in-sf

#31
Game design cannot be improvised!!! ...and it´s one of the ingredients for a successful game.
Here is an excellent book on the subject, now in its 2nd version:
theoryoffun.com

Enjoy! (or meditate.)
#32
I realized it was easier to program 3D shapes (thank you so much Gernot) than using an unknown super-whizz-bang-3D-modeller software. The aftermath of a failed project shows the basic concepts for a CAD modeller. This approach is not the most graphical one, but anything is allowed if you want to program any kind of anything, like a very special procedural deformer, or probabilistic shapes like the natural trees !....
Use, re-use, ab-use, improve, or artistically decimate at will!

main:
Code (glbasic) Select

// --------------------------------- //
// Project: CADpipes_A
// Start: Saturday, November 08, 2014
// IDE Version: 10.283



//notes: Maybe it would make sense to create arrays of 3Dobjects
// in order to group them, (group or "layer")
// so we can quickly choose whether to draw or ommit a whole array/group.
// It depends what you do...
// Draw a group/layer with "FOREACH ob in group_array[]".

//colors are 0xBBGGRR in hex.
//arrows -> move the camera.
// +/- -> zoom
// 1/3,4/6,7/9 -> move model +/- on x,y,z axes.

// to do: every obj in a different color for clarity, then
// all of them in main color for final view. (probably all vertices in white, then use X_SETTEXTURE.)
// 3 guide planes / rasters in xy yz xz would be useful, switchable with "g".


LIMITFPS 25
CONSTANT rseg%=60//20
CONSTANT r_3=1.2
GLOBAL mcol%=0xaaffaa, scrx,scry
GLOBAL mousefree%, mx,my,b1,b2,t$
GLOBAL cam_d=75, cam_phi=6, cam_theta=20, cam_px=0,cam_py=0,cam_pz=0
GLOBAL model_px, model_py, model_pz
GOSUB make_bg


//make all pieces:
make_pipe_A(1,r_3,-1,1,mcol)//small, inside the S's
make_pipe_A(2,r_3,-5,5,0xbbbbbb)
make_pipe_A(3,r_3,0,100,0xe07777)//0x99ff33)

make_shoulder_A(20,r_3,30,90,10,mcol)
make_shoulder_A(24,r_3,30,180,10,mcol)
//make_disc(201,5,360,8,0xff5500)
//make_closed_cylinder(101,5,300,30,1,-1,0x00ffff)
//---------------------------------


//  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
main:
X_MAKE2D ; DRAWSPRITE 1,0,0
X_MAKE3D 1,1024,35

X_CAMERA cam_d*COS(cam_phi)*COS(cam_theta),cam_d*SIN(cam_theta),cam_d*SIN(cam_phi)*COS(cam_theta), cam_px,cam_py,cam_pz
X_AMBIENT_LT 0,0x66bb66
X_SPOT_LT 1,0xccffff,4,2,1,  0,0,0,360

X_DRAWAXES cam_px, cam_py,cam_pz //0,0,0
GOSUB draw_all
SHOWSCREEN
HIBERNATE

//arrows -> move the camera, theta and phi.
//keypad -> 5 = recenter all, else move model's x,y,z.
// 1,4,7 <=> x,y,z and East<=> increase, West <=> decrease.
//Axes: RGB <=> xyz. Easy!
IF KEY(74) THEN INC cam_d,2
IF KEY(78) THEN DEC cam_d,2
setminmax(cam_d, 2, 300)
IF KEY(203) THEN INC cam_phi,2
IF KEY(205) THEN DEC cam_phi,2

IF KEY(200) THEN INC cam_theta,2
IF KEY(208) THEN DEC cam_theta,2
setminmax(cam_theta, -84,84)

IF KEY(79) THEN INC model_px,5 //kp1
IF KEY(81) THEN DEC model_px,5 //3
IF KEY(75) THEN INC model_py,5 //4
IF KEY(77) THEN DEC model_py,5 //6
IF KEY(71) THEN INC model_pz,5 //7
IF KEY(73) THEN DEC model_pz,5 //9
IF KEY(76) // kp "5" = "help, I'm lost"
cam_px=0 ; cam_py=0 ; cam_pz=0 //unused, always 0, weird movements otherwise.
model_px=0 ; model_py=0 ; model_pz=0
ENDIF
IF KEY(48) THEN GOSUB make_bg
//note: the inc/dec should follow the zoom values,as an option.

GOTO main
//   //////////////////////////////////////////////////////////



fn.gbas
Code (glbasic) Select
// --------------------------------- //
// Project: CADpipes_A
// Start: Saturday, November 08, 2014
// IDE Version: 10.283




//*****************************
// obj  1+ --> pipes          *
// obj 20+ --> shoulders      *
//*****************************

FUNCTION make_pipe_A: obnum%, r, l1,l2,col//straight pipe
//LOCAL rseg%=120,
//LOCAL r= 0.33, l1=-2.0, l2=2.0
STATIC ka, kb
X_OBJSTART obnum//1
FOR i=0 TO rseg-1
ka=360*i/rseg ; kb=360*(i+1)/rseg
X_OBJADDVERTEX r*COS(ka),r*SIN(ka),l1, 0,0,col
X_OBJADDVERTEX r*COS(ka),r*SIN(ka),l2, 0,0,col

X_OBJADDVERTEX r*COS(kb),r*SIN(kb),l1, 0,0,col
X_OBJADDVERTEX r*COS(kb),r*SIN(kb),l2, 0,0,col
X_OBJNEWGROUP
NEXT

X_OBJEND
ENDFUNCTION

FUNCTION make_shoulder_A: obnum%,r,sh_seg%,sh_an,sh_r,col  //rounded corner
// works like a deformer. Here the pipe segments' Nb are always rseg!
// bow's length <- shoulder's r and angle. easy.
STATIC ka, kb, ka2,kb2, x1,y1, x2,y2, x3,y3,z3, x4,y4,z4, x5,y5,z5, x6,y6,z6
X_OBJSTART obnum
FOR i=0 TO rseg-1
ka=360*i/rseg ; kb=360*(i+1)/rseg
x1=r*COS(ka)+sh_r ; y1=r*SIN(ka)
x2=r*COS(kb)+sh_r ; y2=r*SIN(kb)

FOR j=0 TO sh_seg-1
ka2=sh_an*j/sh_seg ; kb2=sh_an*(j+1)/sh_seg
x3=x1*COS(ka2)
x5=x1*COS(kb2)
x4=x2*COS(ka2)
x6=x2*COS(kb2)
y3=y1 ; y5=y1 ; y4=y2 ; y6=y2

z3=x1*SIN(ka2)
z5=x1*SIN(kb2)
z4=x2*SIN(ka2)
z6=x2*SIN(kb2)

X_OBJADDVERTEX x3,y3,z3, 0,0,col
X_OBJADDVERTEX x5,y5,z5, 0,0,col
X_OBJADDVERTEX x4,y4,z4, 0,0,col
X_OBJADDVERTEX x6,y6,z6, 0,0,col
X_OBJNEWGROUP
NEXT ; NEXT

X_OBJEND
ENDFUNCTION //ENDSUB worked!


?IF 0 //not compiled, now unused:
// 2D is 200+
FUNCTION make_disc: obnum%, r,an,sectors,col%
STATIC ka, kb
X_OBJSTART obnum //200+
FOR i=0 TO sectors-1
ka=an*i/sectors ; kb=an*(i+1)/sectors
X_OBJADDVERTEX r*COS(ka),r*SIN(ka),0,  0,0, col
X_OBJADDVERTEX 0,0,0,  0,0, col
X_OBJADDVERTEX r*COS(kb),r*SIN(kb),0,  0,0, col
X_OBJNEWGROUP
NEXT
X_OBJEND
ENDFUNCTION
FUNCTION make_closed_cylinder: obnum%, r,an,sectors,thickup,thickdown,col%
STATIC ka, kb
X_OBJSTART obnum //200+
FOR i=0 TO sectors-1
ka=an*i/sectors ; kb=an*(i+1)/sectors
X_OBJADDVERTEX r*COS(ka),r*SIN(ka),thickup,  0,0, col
X_OBJADDVERTEX 0,0,thickup,  0,0, col
X_OBJADDVERTEX r*COS(kb),r*SIN(kb),thickup,  0,0, col
X_OBJNEWGROUP//stripe mode only.
X_OBJADDVERTEX r*COS(ka),r*SIN(ka),thickdown,  0,0, col
X_OBJADDVERTEX 0,0,thickdown,  0,0, col
X_OBJADDVERTEX r*COS(kb),r*SIN(kb),thickdown,  0,0, col
X_OBJNEWGROUP//stripe mode only.

X_OBJADDVERTEX r*COS(ka),r*SIN(ka),thickup,  0,0, col
X_OBJADDVERTEX r*COS(kb),r*SIN(kb),thickup,  0,0, col
X_OBJADDVERTEX r*COS(ka),r*SIN(ka),thickdown,  0,0, col
X_OBJADDVERTEX r*COS(kb),r*SIN(kb),thickdown,  0,0, col
X_OBJNEWGROUP//(edge)
NEXT
X_OBJEND
ENDFUNCTION
?ENDIF //unused functions

FUNCTION setminmax: BYREF a, mi, ma
IF a<mi THEN a=mi
IF a>ma THEN a=ma
ENDFUNCTION


gosubb.gbas
Code (glbasic) Select
// --------------------------------- //
// Project: CADpipes_A
// Start: Saturday, November 08, 2014
// IDE Version: 10.283


SUB draw_all:
X_MOVEMENT -model_px, -model_py, -model_pz ; X_PUSHMATRIX
//top wave:----------------
FOR i=0 TO 2
X_MOVEMENT 40*i,0,0 ; X_PUSHMATRIX
GOSUB draw_S1
X_POPMATRIX
NEXT
//  (end segment)
X_MOVEMENT 100,0,0 ; X_ROTATION 180, 0,1,0
X_DRAWOBJ 24,0
X_MOVEMENT 0,0,0

//mid wave
X_MOVEMENT 0,0,30 ; X_PUSHMATRIX
GOSUB draw_S2
X_POPMATRIX

//bottom wave
X_MOVEMENT 0,0,60 ; X_PUSHMATRIX
GOSUB draw_S2
X_POPMATRIX

//montants hauts / Frame bar:

X_MOVEMENT -30,0,0 ; X_DRAWOBJ 3,0

X_POPMATRIX
ENDSUB

SUB draw_S1:
X_MOVEMENT -20,0,0 ; X_ROTATION 180, 0,1,0
X_DRAWOBJ 24,0
X_MOVEMENT 0,0,2 ; X_DRAWOBJ 24,0

X_MOVEMENT 10,0,1 ; X_DRAWOBJ 1,0
X_MOVEMENT -10,0,1 ; X_DRAWOBJ 1,0
ENDSUB

SUB draw_S2:

FOR i%=1 TO 3
X_MOVEMENT i*40-40,0,0
X_DRAWOBJ 24,0
X_MOVEMENT i*40-50,0,-1 ; X_DRAWOBJ 1,0
X_MOVEMENT i*40-30,0,-1 ; X_DRAWOBJ 1,0
NEXT
FOR i%=1 TO 2
X_MOVEMENT i*40-20,0,-2 ; X_ROTATION 180, 0,1,0
X_DRAWOBJ 24,0
NEXT

//2 end 90 elbows:
X_MOVEMENT -20,0,-2 ; X_ROTATION 90,0,1,0 ; X_DRAWOBJ 20,0
X_MOVEMENT 100,0,-2 ; X_ROTATION 180,0,1,0 ; X_DRAWOBJ 20,0
// 2 end straights:
X_MOVEMENT -25,0,-12 ; X_ROTATION 90,0,1,0 ; X_DRAWOBJ 2,0
X_MOVEMENT 105,0,-12 ; X_ROTATION 90,0,1,0 ; X_DRAWOBJ 2,0
ENDSUB


SUB make_bg:
GETSCREENSIZE scrx,scry
CREATESCREEN 1,1,scrx,scry ; USESCREEN 1
LOCAL c%
FOR i=0 TO scrx STEP (scrx/12.0)
IF RND(100)>33
c=0x010101*(55+RND(190))
ELSE
c=bOR(RND(0xffffff),ASL(0xff,8*RND(2))) //not dull, 1 chanel is full on.
ENDIF
DRAWRECT i,0, scrx,scry,c
NEXT

USESCREEN -1
ENDSUB


#33
For any sciences student this kind of physics ("kinematics" ?) is relatively easy. Adapting a ready-made lib in another language would be more difficult than writing what you need from scratch, I believe. I recommend my previous post on the "analog computer" simulation -> v.good introduction to movements, accelerations, damping (= friction), and resonance.
#34
Tutorials / Re: mainloop()
2014-Aug-22
 MrPlow, I'm totally with you about your fix. Yet I don't remember having any crash. So I agree with Kanonet, if DELETE inside a loop is safe, what else caused the crash?
#35
Spacefractal, it's already feasible and easy -but not recommended normally. By looking closely you will sometimes find that it's o.k. to obfuscate a specific word. Example: GLOBAL emotion$  ...is in use everywhere in the program. You use it to throw and catch messages, communicate between modules. Then have words like "sad", "curious", "in_love" obfuscated as well, it will work. I had a problem when a media name resulted from a concatenation but it was easy to fix: check that the concatenated pieces follow the obfuscation accordingly. The practice has shown me that occasional problems are rare and easy to spot and fix.
Look at the generated code for flip7 (android market) and guess what is what:
Code (glbasic) Select
FUNCTION a942433508: a942741226%, a942283078% //
ALIAS a942344236 AS a942177478
IF a942177478.a942056186=FALSE
//
IF a942741226>=0 AND a942741226<a942177478.a942996609 AND a942283078>=0 AND a942283078<a942177478.a942047006
ALIAS a942109143 AS a942344236.a942985991[a942283078+(a942344236.a942047006)*a942741226]
IF a942344236.a942619820[a942741226][a942283078]<60 //
//
IF a942908340=FALSE THEN a942599879(a942109143)
//

a942247375(a942741226,a942283078,1) //

ENDIF ; ENDIF

ELSE //
//
//
IF a942741226>=0 AND a942741226<a942344236.a942396132 AND a942283078>=0 AND a942283078<a942344236.a942396132
INC a942344236.a942713984[a942741226][a942283078]
ENDIF
ENDIF
ENDFUNCTION
#36
==== EDIT =====
   Finally my obfuscator works -a long, difficult job. It keeps the GLb commands and translates the rest into confusing generic "values", in selectable styles. The media files are automatically copied and renamed with fancy-names which are re-used in the source files accordingly. It worked with my 2505-commands game project, spanned on 10 *.gbas files, and about 50 media files. {Get it on the android market: flip7. By the way the first version costs 1$ and any advice is welcome about monetizing the app in a better way}.
  Back to the obfuscator: the generated code is meaningless : functions, variables, media files, are meaningless, random, looking all similar and confusing. But the program still works like before.
  • Supported features : multi-files, all GLb commands, media copy + renaming, intact 0x..... numbers, mark some words as keep-unchanged, automatic comment removal, choose/make your own style for generated words. Preprocessor code still works.
  • Not supported so far : INLINE'd code.
       Drop me a message if you are interested. You can get the customizable source code for a small price. Licence  :rtfm:  use and modify freely, you only. Don't distribute or sell anything in any way without my agreement. Please contact me for any unspecified case.
#37
This example shows zooming in 2D with 2 fingers on android. Gernot's example must be changed for android: I get 16 detected mice permanently, but never more than 4 pointers. "Pinch" is about looking at fingers behaviour, and can control the 3D camera as well. Pointers location and number are shown on screen. Works on Archos tablet 10.1 G9. Have fun and tell us your story.
Code (glbasic) Select
// --------------------------------- //
// Project: pinch00
// Start: Tuesday, April 15, 2014
// IDE Version: 10.283
// SETCURRENTDIR("Media") // go to media files

SYSTEMPOINTER TRUE
CONSTANT rectNb%=33 // up to you
GLOBAL scrx%,scry%, zoom=1.0, cx,cy
GLOBAL sqx[],sqy[],sqw[],sqh[],sqcol%[]
GLOBAL mx%, my%,b1%,b2%
DIM sqx[rectNb+1] ; DIM sqy[rectNb+1] ; DIM sqw[rectNb+1] ; DIM sqh[rectNb+1] ; DIM sqcol[rectNb+1]
FOR i% =0 TO rectNb
sqx[i]=RND(900)*0.001 ; sqy[i]=RND(900)*0.001
sqw[i]=0.05 +0.001*RND(155) ; sqh[i]=0.05 +0.001*RND(155)
sqcol[i]=RGB(255/(1+RND(4)),255/(1+RND(4)),255/(1+RND(4)))
NEXT

GETSCREENSIZE scrx,scry ; cx=scrx*0.5 ; cy=scry*0.5

//********************
WHILE TRUE
GOSUB redraw
?IFDEF WIN32
GOSUB kees //windows only. No double glazing.
?ENDIF
GOSUB mousedetect
SHOWSCREEN
WEND
//********************

END

SUB redraw:
FOR i%=0 TO rectNb
DRAWRECT scrx*(0.5+(sqx[i]-0.5)*zoom),scry*(0.5+(sqy[i]-0.5)*zoom), _
scrx*zoom*sqw[i], scry*zoom*sqh[i],sqcol[i]
NEXT
ENDSUB

?IFDEF WIN32
SUB kees:
STATIC k$
k$=INKEY$()
SELECT k$
CASE "," // <<
zoom=zoom*0.99
CASE "." // >>
zoom=zoom*1.01
ENDSELECT
ENDSUB
?ENDIF

SUB mousedetect:
STATIC newmousecount%, zoomMem, mem //mouse distance
STATIC mouseAmount%
newmousecount=GETMOUSECOUNT() ; mouseAmount=0
//draw pointers
FOR i%=0 TO newmousecount-1
//0->15 on android, all the time.
      SETACTIVEMOUSE i
      MOUSESTATE mx, my, b1, b2
      IF (b1+b2)
      drawmouse(i) ; INC mouseAmount
      ENDIF
      PRINT newmousecount, 10,200
      // always =16 on android, Archos tablet G9 10.1
NEXT
//fingers' gym (best with 2 fingers...)
SELECT mouseAmount //how many fingers on screen?
//CASE 1 // glide
//
CASE 2 //zoom. Implement rotation here.
// could change camera position and FOV in 3D.

IF mem=0.0 //fresh fingers
mem=getdistance()
zoomMem=zoom //store the start values.
ELSE // pinch that spot, enjoy the magic
zoom=zoomMem*getdistance()/mem
ENDIF
//CASE 3 //special config. Usable.
//CASE 4 //Usable too. Wave a white flag.
DEFAULT
mem=0.0 // fingers off
ENDSELECT
ENDSUB

FUNCTION drawmouse: n%
STATIC p%
FOR i%=0 TO n
p=55+i+i+i
DRAWLINE mx-p,my-p,mx+p, my-p, 0xffff00
DRAWLINE mx-p,my+p,mx+p, my+p, 0xff99ff
DRAWLINE mx-p,my-p,mx-p, my+p, 0xff99ff
DRAWLINE mx+p,my-p,mx+p, my+p, 0xffff00
NEXT
ENDFUNCTION

FUNCTION getdistance:
STATIC mx1%,mx2%,my1%,my2%,bb%,bbb%,d
SETACTIVEMOUSE 0
MOUSESTATE mx1,my1,bb,bbb
SETACTIVEMOUSE 1
MOUSESTATE mx2,my2,bb,bbb
d=SQR((mx1-mx2)*(mx1-mx2) +(my1-my2)*(my1-my2))
PRINT "                       ", 30,30
PRINT d,30,30
RETURN d
ENDFUNCTION
#38
3D / Re: 3D transparency
2013-Nov-05
Thanks guys. The problem is not solved but I found a way around it.
Quote from: kanonet on 2013-Oct-31
BTW. RGBA = bOR(RGB(r,g,b), ASL(a, 24))
-> yes I tried it but didn't work.  :( (something like vertex color = 0x77ffffff and 0x77ffffee)
However I made an interesting discovery that does the job if speed is no issue:
after drawing something transparent in 3D, go back shortly to 2D before the next 3D element. The results are excellent -but a bit slow. How it works, what I believe: when you go back to 2D the z-buffer is reset, so everything already there is considered as 2D. The next 3D drawing happens on top of a 2D sprite, with no z-buffer fuss. 3D transparency becomes perfect like that. You still need all vertex colors at 0xffffff, but color and alpha can be on the texture sprite. ALPHAMODE works in 3D then, both positive and negative. Try it too and show us your results!
#39
[-]  I'd like to set myself the background color of some portions of the code, for better readability.
[-]  The "find" (ctr-f) tool needs an option to search directly through all *.gbas files of the project, when you have many of them.
[-]  Sometimes it's useful to add a comment in the middle of a long line. How about implementing something like /-shortcomment-/ ?
#40
3D / 3D transparency
2013-Oct-30
Hi!
I need an X_ALPHAMODE, or an X_OBJADDVERVERTEX with RGBA colors. Any idea?
Not easy I guess. GL ES for android makes it even worse...

Code (glbasic) Select
// --------------------------------- //
// Project: test-3D-transparency
// Start: Wednesday, October 30, 2013
// IDE Version: 10.283


SETCURRENTDIR("Media") // go to media files

CONSTANT MK3D1%=1, MK3D2=256, MK3D3=80 // zfar down to 16 is still o.k. for this example!
LOADSPRITE "smallpicture.png",1
DRAWSPRITE 1, 3,3

X_OBJSTART 0
X_OBJADDVERTEX -1.0,-1.0,0.0,  0.0,1.0, 0xffffff //SW
X_OBJADDVERTEX -1.0, 1.0,0.0,  0.0,0.0, 0xffffff //NW
X_OBJADDVERTEX 1.0 ,-1.0,0.0,  1.0,1.0, 0xffffff //SE
X_OBJADDVERTEX 1.0 ,1.0 ,0.0,  1.0,0.0, 0xffffff //NE
// Note: is there no way to enter an alpha color?
// As soon as you use a color different from 0xffffff
// the ALPHAMODE stops working, stopping transparency.

// Problem: I must choose either vertex colors or transparency,
// but I need both.
X_OBJEND

X_MAKE3D MK3D1, MK3D2, MK3D3//1,256,80
X_CAMERA 0,0,3,  0,0,0
X_SETTEXTURE 1,-1
ALPHAMODE -0.33

FOR i%= -4 TO 0
X_MOVEMENT 0,0,i
X_DRAWOBJ 0,0
NEXT

SHOWSCREEN
MOUSEWAIT
END
#41
Sorry, I never used animated meshes. I hope you can find something useful if you look at OGRE, since it does support animated meshes, but I dont't remember the format (sorry)...
#42
FAQ / Re: Android Tips
2013-Oct-26
Thanks a lot ampos!
Planetm, an easy way to impose your orientation to android is to do something like

SETSCREEN 9000,9099,0 // if you want a portrait

or

SETSCREEN 9099,9000,0 // if you want a landscape.

It works well for me in the emulator (small screen)+ large tablet G9 10.1 inch Archos.
Good luck!
#43
There is also this useful way: use the pre-processor.

?IFDEF TESTING_CONDITION // or silly name
  //Plenty of dodgy code
  // that you don't want.
?ENDIF

To enable the code, write at the very top:
?DEFINE TESTING_CONDITION

Like this it's easy to switch from old to new version of a snippet, and vice-versa:

?IFDEF NEWVERSION
   //new code here.
?ELSE
   //old code here
?ENDIF
#44
Easy: export the file as *.3ds  then use GLb's tools to convert the *.3ds to *.ddd
#45
Nice one Hatonastick!
I'm back with a final update that only uses GLb syntax. Getting started becomes easy now.
Code (glbasic) Select
// --------------------------------- //
// Project: encaps_function

// The green "this" remains a mystery to me,
// but this is the way to stick to the GLb syntax:
TYPE sq
loc%=33; size%=100;
dir%=1;
//wish$="go_sailing"
FUNCTION changesize: // a member function, "encapsulated".

IF self.dir>0
INC self.size
IF self.size>222
self.size=200
self.dir=0
ENDIF
ELSE
DEC self.size
IF self.size<77
self.size=88 ; self.dir=2
ENDIF
ENDIF

ENDFUNCTION
FUNCTION draw:
DRAWRECT self.loc,self.loc,self.size,self.size, 0xffbb99
ENDFUNCTION
ENDTYPE

LOCAL s AS sq  //instanciation, builds object s from type/template sq.
// (s.loc=33 automatically)
LOCAL s2 AS sq
s2.loc=222 //adjustment, kind of polymorphism.
WHILE TRUE
// call member functions of the object:
s.changesize() // 'self' will refer to s.
s.draw()
s2.changesize() // 'self' will refer to s2.
s2.draw()
// i.e. push the external buttons of
// the closed object.
SHOWSCREEN
WEND

// P.S. a typical example of such member functions are
// "accessors", used to get or set the encapsulatd values
// of the object from the outside.