# deluksic

Member Since 21 Jun 2011
Offline Last Active Mar 19 2013 04:14 PM

### Function Tester

29 July 2012 - 09:36 PM

Function Tester
by Deluksic

Function tester is a nice and simple program which helps you create desirable functions in no time, with great precision and at any reasonable scale! Just write the function and it will plot it for you! The most common usage is motion and graphics. For example, the menu card in the program uses the following function to move up and down:

sin((x-0.5)*pi*1.287)/1.8+0.5

where x is time variable.

Be careful because the program uses execute_string() to calculate, so if you make a mistake, it will throw an error!

Max and min precision are number of times the function is subdivided. For example if prec. is 12, number of subdivisions is
2^12 = 4096. It can get up to 14, then it is 16384! segments. Can't go higher than that, because it would exceed the array size.

Few valid functions:
• sqr(x)
• sqrt(abs(x))
• sin(x)
• 10/(abs(x)+1)
• power(2, x)
• x + sin(x)
• sqr(x)/30 - 10/(abs(x)+1)+ cos(x*5)
• (x-0.5)<<0.5 which is the same as floor(x)
• (x+0.5)<<0.5 which is the same as ceil(x)
• 1/(x+sign(x))

The screenshots:

### Retro CRT distortion effect using RGB shifting

22 July 2012 - 05:54 PM

• Title: Retro CRT Distortion effect using RGB shifting.
• Description: Example, and a script for creating RGB shift effect.
• GM Version: :GM81:
• Registered: yes, uses surfaces.
• File Type: .gmk
• File Size: 63KB

Summary
This is an example of creating distortion effect using RGB shifting, explained at this website. Actually I've tried to recreate the effect and I think I've succeeded :D. It uses background_create_from_screen, but it can be changed to screen_redraw if needed. I just tought it is easier to use with this function rather than screen_redraw. This kind of effect can also be used for many kind of things like explosions, pausing the game (bf3 has the RGB shift when paused) etc. Hope you like it.

Example of usage

* when you run the program, open menu tab and click crt effect to turn it on

### Vector2D - vector engine to minimize coding

25 June 2012 - 02:22 PM

Introduction

I've been programming in game maker for last few years, and I often find myself writing x and y sets of variables for every position, speed, force vector etc.
So I thought, why not make a universal engine for these?
I've been also programming in XNA game studio, where you have integrated vector system, that makes your code look simpler and cleaner

for example:

```//instead of
speedx += accelerationx;
speedy += accelerationy;

//you write

How engine works

The vectors in the engine are something like surfaces. You can create them by using v2d_create(x,y) function which returns the id of the vector, and later you use that id to make all mathematical operations on them (also included functions). You can also delete a vector by using the v2d_free(id) which doesn't actually delete it, but makes it available to overwrite.
This is an example of how you would use it:

```//create event
position = v2d_create(0, 0);
speed = v2d_create(0, 0);
acceleration = v2d_create(0, 0);

//step event

//draw event
draw_sprite_v2d(sprite_index, image_index, position);```

Current function list

• v2d_init() - initializes the vector engine

To access each component of the vector, just use:
• v2d_x[id];
• v2d_y[id];

Managing vectors
• v2d_create(x,y);
• v2d_free(id);
• v2d_copy(source, destination);

Setting vectors
• v2d_set_xy(id, x, y);
• v2d_set_lendir(id, len, dir);
• v2d_set_length(id, len);
• v2d_set_point(id, x1, y1, x2, y2);

Mathematical functions
• v2d_subtract(id1, id2, destination);
• v2d_dot(id1, id2);
• v2d_cross(id1, id2);
• v2d_angle2(id1, id2);
• v2d_project(id1, id2, destination);
• v2d_distance(id1, id2);
• v2d_multiply(id, amount);
• v2d_normalize(id);
• v2d_rotate90(id, clockwise?)
• v2d_length(id);

Drawing functions (more to come)
• draw_sprite_v2d(sprite_index, image_index, id);
• draw_sprite_ext_v2d(...)
• draw_vector(id, x, y);
• draw_vector_v2d(id, position vector id);
• draw_arc_v2d(id1, id2, x, y, radius);

The download contains scripts and examples of usage. When you run the game, adjust vectors by 'left mouse button' and go trough rooms by 'Enter'

New function suggestions are always welcome!

### Fancy Minesweeper

19 June 2012 - 03:56 PM

Hello, here is another one of my games that i (almost) finished! :D

Everything is click based except that at the end you have to press Ctrl to restart.

You can double click on a square to open other squares automatically just like in the real minesweeper.
Right click marks/unmarks a square..

Enjoy!

Here i won the game! :

this was made using Game Maker 8.0 pro

NEW LIGHT GRAPHICS!

### Bike Engine for GM 8.1 lite

03 June 2012 - 10:52 AM

Hey, I've seen many people asking how to make bike physics like Motorbike mania, crosser games etc.

So I've made a simple demo that doesn't use GMPhysics or any other dll! I would like feedback, because I need to know if I should continue on this

Features:
- walls of all kinds: line, arc, circle; and width can be changed in all of them (it can also be negative to subtract from the wheel's radius, can be used for 'grinds')
- ball physics (rotations, collisions with walls etc.)
- connections between balls (can be used as suspensions and rods to create a bike), also known as verlet physics..
- every part of the engine is adjustible (gravity, friction, acceleration, damping maybe..)

the problem is that i don't use prediction of collisions so it can happen that a ball goes trough walls, i'm sorry for that :/

you can also visit my site :D

Controls: (sorry for non-intuitive interface)
- hold 'L' to draw Line walls
- press 'C' to start drawing Curved walls and hold 'C' again to adjust angles the wall is active in (it always chooses the less than 180 angle)
- hold up to accelerate (rotates the back wheel actually)
- press space to stop both wheels (brake) (it also creates another ball ^.^)
- hold down to decelerate and go backwards (rotates back wheel in other direction)
- hold left to lean left (changes length of rods that connect body to the bike)
- hold right to lean right (changes length of rods that connect body to the bike)

- mouse left button to drag balls around

A simple trick can be done if you pres left, up, right fast :D it does a "bunny hop"