Jump to content


Rolfero

Member Since 30 Oct 2008
Offline Last Active Mar 22 2012 09:07 AM

Topics I've Started

Best Way To Implement Flooding

09 May 2010 - 08:47 PM

Hi guys, what do u think would be the best way to implement water flooding like this:
Posted Image

I guess some sort of physics thing would be needed for best results.

Warpout

23 December 2009 - 10:49 AM

Simple breakout game, with a twist.
Controls:
Move paddle with mouse, left click to release ball.

Took me less than a day to get this far.
Really easy, actually. Just make a normal breakout game, then add the twist.

Anyways, if you find any bugs, tell me.

[url="http://"%20<a%20href="http://www.yoyogames.com/games/108033-warpout""%20target="_blank">http://www.yoyogames.../108033-warpout"</a>"]YoYoGames[/url]
Posted Image
Posted Image
Posted Image

Move_contact_object

04 December 2009 - 06:42 PM

Moves the object towards a direction, only stopping at a specific object, or at a specific range.

move_contact_object(direction,maximum distance,object)

[codebox]m_x = x;
m_y = y;
while (!place_meeting(x,y,argument2)) {
x += lengthdir_x(1,argument0);
y += lengthdir_y(1,argument0);
if point_distance(x,y,m_x,m_y) >= argument1 {
break;
}
}[/codebox]

Finding The Right Image_index From A Sprite...

07 November 2009 - 08:57 PM

Okay, I have this sprite. It includes Standing still, walking, and shooting in 8 directions. I use some codes to make it select the right image_indexes from the sprite. Unfortunately, it isn't working.

object_unit step event:
[codebox]if instance_exists(pathfind) {
with (pathfind) {
parent.maindir = get_direcion(path_get_x(path_index,path_position),
path_get_y(path_index,path_position),path_get_x(pa
t
h_index,path_positionprevious),path_get_y(path_ind
e
x,path_positionprevious),parent.maindir);
}
}
State = (mainstate*8)+maindir; //set State!
image_index = unit_sequence(UIName,State); //set image number by sequence[/codebox]
object_unit alarm 0 event (in create event the code alarm[0] = 1; code is)
[codebox]pathfind = pathfinder_add();
global.current_noob = id;
with (pathfind) {
parent = global.current_noob;
}[/codebox]
pathfinder_add() script:
[codebox]return instance_create(x,y,obj_pathfinder);[/codebox]
get_direcion() script:
[codebox]_x = argument0;
_y = argument1;
_xp = argument2;
_yp = argument3;
if _x = _xp {
if _y = _yp {
return argument4;
}
else if _y < _yp {
return 0;
}
else {
return 4;
}
}
else if _x > _xp {
if _y = _yp {
return 6;
}
else if _y > _yp {
return 5;
}
else {
return 7;
}
}
else {
if _y = _yp {
return 2;
}
else if _y > _yp {
return 3;
}
else {
return 1;
}
}[/codebox]
unit_sequence() script:
[codebox]ind = image_index;
_unit_ = argument0;
img = 0;
State = argument1;
for (i=0; i<=State; i+=1) {
img += real(gvar_get("_art_Sequence_Unit_"+_unit_+"_"+s(i),real(gvar_get("_art_Sequence_Unit_"+_unit_+"_Default",1))));
c_state_end = img-1; //where does the animation end?
c_state_start = img - real(gvar_get("_art_Sequence_Unit_"+_unit_+"_"+s(i),real(gvar_get("_art_Sequence_Unit_"+_unit_+"_Default",1)))); //and where does it start?
}

if ind < c_state_start {
return c_state_start;
}
else if ind >= c_state_end {
return c_state_start;
}
else {
return ind+1;
}[/codebox]

Everything works ALMOST brilliant. The unit ALWAYS use image_index 0 (maindir 0 and state 0) for stationary, and image_index 8-13 (maindir 0 and state 1) for movement. When in debug mode, it tells me the maindir is ALWAYS 0. Why? Can you spot the error?

I have searched for this problem quite some time now.

And I know I spelled get_direcion wrong.

Mask Help

26 October 2009 - 08:19 AM

Okay, here is my problem.
I have this object, "object".
This object uses mp_grid to move around, whenever I've ordered it to move. My map uses different heights, so when the player walks up a hill, the x and y shouldn't change, while the sprite should be drawns higher up and the mask should be higher up. If this unit would fly the mask would lie on top of any hills, and the sprite should be way up in the sky.

Problem is... the mask is obviously "drawn" at the x/y position... not at the x/y+ground_height position.

Halp plx?

Maybe some workaround?