Articles

Shake my chicken with Pico8...

Image
      Fig.1 #Pixcode Shake The syntax of the code does not correspond to a particular language. This "code" just allows to understand the process to follow.       Fig.2 Do it with Pico8     --Shake my chicken! function _init() intensity=0 end function _update()     cls()     if btnp(❎) then         intensity=5     end end function _draw()     shake()     spr(1+(time()*5%4),60,60)         print(intensity,0,10,15)     print("press ❎ to shake",35,80,15) end function shake()     local shakex=(rnd({-intensity,intensity}))     local shakey=(rnd({-intensity,intensity}))     print(shakex,0,17,15)     print(shakey,0,24,15)     intensity*=0.9     if (intensity<=0.5) intensity=0     camera(shakex,shakey) end

Collision Circle/Square or Rectangle with Pico8

Image
1- Collision circle/square with sine and cosine just for fun!     Sometimes I do useless stuff just for fun and to get my brain fired up, when simpler solutions exist!!! If you had to choose only one solution, the second one is the most reasonable ;-)    #pixcode 1: Detect the corners of a square     #pixcode 2: There is a collision, but D > 0, so the collision is not detected. We need to check the vertical and horizontal alignment.  function _init() --circle center x1=90 y1=60 --square center x2=60 y2=80 d=10 --square side/2 r=10 --radius end function _update() --controls if (btn(0)) x1-=1 if (btn(1)) x1+=1 if (btn(2)) y1-=1 if (btn(3)) y1+=1 --calculate oc a=abs(x1-x2) b=abs(y1-y2) oc=sqrt(a^2+b^2) --calculate sine and cosine cosa=b/oc sina=a/oc --calculate di. The value 0.7071 is only for a square if cosa <= 0.7071 then     di=d/sina else di=d/cosa end --check collision with a corner or middle edge if (oc<=(r+di)) then     corner=1 else corner=0 end --check the collision

Gmamemaker Studio 2: Simulate a light effect around a sprite (player, fire, explosion...).

Image
The player is followed by the obj_playerLight Hi all! This light effect is a kind of hole into a dark surface over layers of your game. This surface can be placed whereever you want: over all layers or between two layers. You can set the darkness intensity with alpha between a value from 0 (no darkness) to 1 (totaly black). We are going to create a light object associated to a sprite. This sprite is a simple white circle (Fig. 1). But you can use an animated sprite (Fig. 2).   Fig. 1 obj_playerLight    Fig. 2 obj_playerLight2 If you use a simple white circle, it would be interesting to make it animated by increasing and decreasing the radius with the function draw_sprite_ext. obj_playerLight: Create, Step and draw event. obj_playerLight2: Create, Step and draw event. Thanks for reading! Pssst! Play my game!!! Ghost'n Brothers 1bit (free) and Ghost'n Brothers (paid version). Only on iOS.

Do things with draw_line function: connected lines

Image
This tutorial is for beginners to learn how to use draw_line and draw_point functions and arrays. If you like math, add cosines and sines to do nice things just for fun! We will create a broken line with the draw_line_color and draw_point_color functions. The function draw_line_color(x0, y0, x1, y1, c_green, c_green) has 6 arguments. The first 4 correspond to the coordinates of the points (x0, y0) and (x1, y1) between which a line segment will be drawn. With each click on the screen, a point will be created which will be connected by a line segment to the previous one. For this, we will have to use a "loop for " with the " draw_line " function. So I have created 4 arrays AX, AY, BX, BY to record the coordinates xn, yn, xn+1, yn+1. Fig. 1, shows the organization of the x and y coordinates in the arrays. Fig. 1: 4 arrays to store coordinates You will notice that we always have, for all the arrays, the coordinates of the previous point and the next po

ScreenShake - Gamemaker Studio 2 - Methode 1 & 2 - Tuto fr complet

Image
Deux méthodes pour créer un tremblement d'écran (screenshake). Méthode 1: L'objet est créé à la demande, puis détruit une fois son rôle terminé. Il faudra recréer cette instance à chaque fois que cela sera nécessaire. Méthode 2: L'objet créé sera juste désactivé en fin d'action, puis sera réactivé en fonction des besoins

GameMakerStudio 2: GUI Layer and multi-touch: Create 3 buttons (left, right, and jump) for your iOS game.

Image
Last Update:  Feb, 2021 Released Button issue has been fixed. Using Keyboard to control your sprite is relatively easy to implement with the function keyboard_check(key) . But if you want to run your game on your mobile device, you need to implement multi touch buttons…You can find many tutorials about GUI layer and buttons on the web, but  i’ve not been able to find anything about iOS development so it  is what i’m going to try to do! Have you ever heard about Downwell and the Gun Boots? Downwell is a very polished game. Control buttons are very responsive and fast. 3 buttons: Left, Right, and a dual action button to jump and shoot. We will try to reproduce the same mechanics except the third.  The last button will be only associated with the jump movement. Downwell by Ojiro Fumoto @moppin The big question is ... What is the best way to fix the position of the control buttons on the screen? If you just place the instance of your button object within the room, when the cam