• Content Count

  • Joined

  • Last visited

About espace

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. espace

    is group better ?

  2. espace

    is group better ?

    If sprite1 is a group and I add sprite2 to this group, I don't need to update the position of sprite2 to follow sprite1. My question : is there a benefit in term of cpu for that?
  3. espace

    is group better ?

    hi, i have a sprite and i use another sprite who follow the first. update:function(){ sprite2.x=sprite1.x sprite2.y=sprite1.y }, is there a benefit in this case of using group ?
  4. hi, when i comment this function my game run well but without comments the speed is not optimal. Could you tell me what i'm doing wrong or what to improve ? ps : i give the image of my sprite, it maybe help some solutions.... Big thanks to you. // specific function to create an sprite object with these parameters o.flash={ //object image: "flash_blanc" flag:false, } //to lock a function and be sure that the function not run twice f.lock = (obj, callback) => { if (obj.flag == false) { obj.flag = true; callback(); } } // launch tween f.anim_flash=(obj,p)=>{ =game.add.tween(p.o).to({ alpha: p.a }, p.t, p.e, true, p.d, p.i, p.y); // reset the flag of the obj oncomplete ()=> {o.flash[1].flag=false},this) } //on input onDown launch the tween f.stop_body = function () { if (o.paper[1].flag == false) { f.lock(o.flash[1], ()=> {f.anim_flash(o.flash[1],o.flash_tw_p1)}) } } // in update game.input.onDown.add(f.stop_body, this);
  5. espace

    help me to understadn increment ?

    i would the same than the one case.
  6. hi, i don't understand the principle of increment with javascript. This snippet works well : //in update f.big=(obj,speed)=>{ if (obj.scale.x < 8) { obj.scale.setTo(obj.scale.x + speed) } } but this example don't work however it's supposed to be the same...why that don't works ? // in update f.pointer_big=(obj,speed)=>{ if (obj.scale.x < 8) { obj.scale.setTo(obj.scale.x++ * speed) } }
  7. Okay, i use this function minder. i give my vimrc, could you give your also, it could be interesting to discover new features ""interface set encoding=utf8 set mouse=a set noswapfile set autoindent set clipboard=unnamedplus " recherche incrementielle set incsearch set cursorline " insensible à la casse dans les recherches set ignorecase " insensible à la casse dans les chemins set wildignorecase "" true color " vertical line to show position set cursorcolumn " always center cursor set so=999 "autoindent filetype indent on " to center always the view set so=999 " relative number set number set relativenumber " COLORS set background=dark colorscheme onedark let g:AirlineTheme='base16_codeschool' syntax on set termguicolors set guifont=fontAwesome:h9 " PERSONAL COMMAND " open snippets for phaser in a vertical split command Pref vsplit ~/.vim/plugged/vim-snippets/snippets/javascript/javascript-phaser.snippets command Config vsplit ~/.config/nvim/init.vim " CUSTOM KEYBINDING "NORMAL MODE nnoremap <C-Up> VDkPk <CR> nnoremap <C-Down> VDjPj <CR> nnoremap <C-a> ggVG <CR> nnoremap <C-=> G=gg <CR> map <F2> :TernDoc<CR> "move between split nnoremap <C-J> <C-W><C-J> " grepper KEYBINDING map <C-f> :Grepper<CR> nmap gs <plug>(GrepperOperator) xmap gs <plug>(GrepperOperator) "INSERT MODE inoremap <C-Space> <C-x><C-o> " Plugins will be downloaded under the specified directory. call plug#begin('$HOME/.vim/plugged') if has('nvim') Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } else Plug 'Shougo/deoplete.nvim' Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' endif " DECLARE THE LIST OF PLUGINS. Plug 'ternjs/tern_for_vim' Plug 'scrooloose/nerdtree' Plug 'Raimondi/delimitMate' Plug 'rhysd/github-complete.vim' Plug 'easymotion/vim-easymotion' Plug 'terryma/vim-multiple-cursors' Plug 'vim-syntastic/syntastic' Plug 'kien/ctrlp.vim' Plug 'pangloss/vim-javascript' Plug 'vim-scripts/indenthtml.vim' Plug 'walm/jshint.vim' Plug 'heavenshell/vim-jsdoc' Plug 'ervandew/supertab' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'ryanoasis/vim-devicons' Plug 'mhinz/vim-grepper' "Plug 'majutsushi/tagbar' "" diagram uml ""Plug 'scrooloose/vim-slumlord' Plug 'aklt/plantuml-syntax' Plug 'tyru/open-browser.vim' "" multiple cursors Plug 'terryma/vim-multiple-cursors' Plug 'vim-airline/vim-airline' " Airlines THEMES Plug 'vim-airline/vim-airline-themes' " COLORS THEMES Plug 'drewtempelmeyer/palenight.vim' Plug 'thenewvu/vim-colors-sketching' Plug 'tyrannicaltoucan/vim-deep-space' "Plug 'joshdick/onedark.vim' " List ends here. Plugins become visible to Vim after this call. call plug#end() " SUPERTAB "scroll from top to bottom "let g:SuperTabDefaultCompletionType = "<c-n>" let g:python_host_prog = '/usr/bin/python2.7' let g:python3_host_prog = '/usr/bin/python3.6' "maybe to delete noautocmd "" start deoplete at startup let g:deoplete#enable_at_startup = 1 set statusline+=%#warningmsg# set statusline+=%* "" disable autocomment when insert line autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " Automatically reload vimrc when it's saved " autoreload vimrc autocmd! BufWritePost init.vim,.vimrc source % "" auto indent on save augroup autoindent au! autocmd BufWritePre * :normal migg=G`i augroup End "" ignore file with ctrlp set wildignore+=phaser.js,phaser-min.js "COMMANDES FOR SYNTASTIC "let g:syntastic_always_populate_loc_list = 1 "let g:syntastic_auto_loc_list = 1 "let g:syntastic_check_on_open = 1 "let g:syntastic_check_on_wq = 0 " INTERESTING SHORTCUTS " yi( copier à l'intérieur de la parenthèse " ya( copier à toute la parenthèse " Markdown "sudo npm install -g livedown "livedown start --port 4242 --open" nmap <leader>g :Grep <c-r>=expand("<cword>")<cr><cr>
  8. What are the benefits in vscode ? Could you give me theses special features ?
  9. Are you speaking about reload the page ? if yes, I use browser-sync when you save your files, it automaticaly reload the page browser-sync start --server --files "*/*.*"
  10. No one speak about vim ? The best for me !!!! Light, huge list of plugins, speed coding, never bug.
  11. Hi, I have a sprite and i listen his scale. When his scale is bigger than 2, i do an action. The problem for me is : i'm in a update function and i must lock my action to launch it one time. Is there not a better solution who avoid the use of flag ? For example with the language lua => corona, we have listeners who avoid this situation... var lock_action = (obj, callback) => { if (obj.flag == false) { obj.flag = true; callback(); } } var doSomething=()=>{console.log("done")}; // in update function if(obj.scale.x > 2){ lock_action(obj,doSomething) }
  12. espace

    WeChat Mini Game WIP

    Can you give a link to test it ?
  13. hi, i have start my project with ES6 syntax, but for exporting to in canvas mode it must be ES5 syntax. What's the easier way to do that ? (i have try with babeljs but without success) if not i rewrite all with ES5 syntax but it's not convenient.... Another question why coding in Es6....finally is there a good benefit with mobiles games?
  14. hi, i would have a prompt box who check different state : length of the name not the same name than the opponent but how do you do to loop this function to be sure that the player don't press ok at the final dialog box and have a name_player == null ? => see in the snippet var f={} var name_opponent=["roger","gilbert"] f.check_if_username_is_not_in_database_enemy=(st)=>{ for (var i = 0; i < name_opponent.length; i++){ return (st === name_opponent[i]) } } f.prompt=()=>{ let test = localStorage.getItem("username") if(typeof test != "string"){ name_player = prompt("Please enter your name", "Anonymous") if(name_player) { if (name_player.length < 4) { name_player = prompt("Please enter min. 4 letters", "Anonymous") } if(f.check_if_username_is_not_in_database_enemy(name_player) == true && name_player.length > 4){ localStorage.setItem("username", name_player) alert(localStorage.getItem("username")) } if(f.check_if_username_is_not_in_database_enemy(name_player) == false){ name_player = prompt("Name already exist, please choose a different name", "Anonymous") //if the player press ok the name_player === null } } } } f.prompt()
  15. Hey hey you are french ? i have already look at this but it show me phaser functions and not my personals functions... It resort often frame properties and take a lot of times but I don't know how to reduce this.