Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Wednesday, January 11, 2017

Gamemaker tips for top down shooter

I have played around with Gamemaker for sometime and heres few tips for top down shooter.


1. Movement


I like to movement towards cursor and with WASD keys so here is how i did it.

W

move_towards_point(mouse_x,mouse_y,speed);


speed should be positive because you should move towards mouse cursor



S

move_towards_point(mouse_x,mouse_y,speed);



and here speed should be negative example -20 so char would walk away from cursor



A,D keys should not be done with this and i think they should just be strafe, so postive and negative speed on x-axis



2. Weapons, shooting and switching



I like to do this with scripts and just switch the shooting script



On your hero,char,shooter you would have

Equipped variable and to that you can store script

example

Equipped=pistol;



on mouseleft or your shooting key you just execute Equipped

script_execute(Equipped);



on a pistol script you create bullets and shoot



3. Switching weapons



So if do switching with 1,2,3.... keys, you can just make that key to switch

the Equipped script



example when 2 is pressed

Equipped=Shotgun



example when 1 is pressed

Equipped=Pistol


Now when 1,2,3... is pressed it changes the script what mouseleft then executes.

4. Gun with kick

So at shooting script (Pistol,Shotgun)script i have the shooting and movement... yes movement so the gun will have a littlebit of kick

example in shotgun
move_towards_point(mouse_x,mouse_y,speed);
and speed should be negative in this one so it moves away from cursor 

  
 



Monday, May 2, 2016

Raspbx and running scripts

Hi

I have worked with old asterisk version and it was really hard to work with but with little efford really great and customizable. Now i tried new project with RASPBX and i was surprised how easy it was to work with.

In this tutorial i will tell how to install raspbx and run scripts in raspbx

1. Download Raspbx (google it)
2. Download win32diskimager
3.Install win32diskimager
4.Unzip raspbx image
5. Run win32diskimager and install raspbx to memorycard (raspbx site says that 4gb card required, so i used 8gb just to sure)
6.Insert memory card to raspberry pi and start it
7.Log in
8. Default user is root and password raspberry
9. run command:sudo ip addr show
10. get the inet addr/ip addr
11. Use different computer to log in by opening browser and writing that address to browser
12.  FreePBX default user is admin and password is admin also
13. Log in to Freepbx
Asterisk may take 5-10 minutes to start
14.Download config edit module to freepbx from admin modules
14. or you can just download and upgrade all the modules
15. go to config edit module and to extensions_custom.conf add
[nameofdialplan]
exten=> 2000,1,Answer()
exten=> 2000,2,AGI(scriptname.php)

2000 is the extension that you wanna run script when calling
1,2 is the priority or order of actions you wanna perform
there should be scripts ready if you wanna test.

Example wakeupconfirm
[wakeup]
exten=> 2000,1,Answer()
exten=> 2000,2,AGI(wakeconfirm.php)

16. Go to custom destinations tab and make asterisk aware of new custom dialplan by adding
[wakeup],2000,1
description is just name so name it as you like it
17. Create extension for your phone/softphone and try it

Making your own scripts
1. run commands:cd /var/lib/asterisk/agi-bin
this is the path where asterisk will store the scripts
2. run command:nano scriptname.php
you can use other text editors but i use nano
3.write your script
4.run command:chmod 755 scriptname.php
this gives asterisk permission to run the script