Jump to content


slayer 64

Member Since 09 Oct 2007
Offline Last Active Mar 14 2016 12:12 AM

#4923117 Collision Checking with Controller Object

Posted by slayer 64 on 22 December 2015 - 12:27 AM

this'll work great
with player
{
    if place_meeting(x,y,other.enemy)
    {
       with other.enemy hspeed=0
    }
}

  • 1


#4922296 Saving & Loading Procedurally Generated Worlds With ds_grid

Posted by slayer 64 on 20 December 2015 - 01:34 AM

Only problem is that there are HUNDREDS of different objects. Does this mean I need to repeat this process for all of them?

all the objects the user creates and you want to save could have a parent object, then a script could loop through all the objects by using the parents name.
 
var file=file_text_open_write("myLevel.txt")

//we'll need to know how many objects to create when we load
file_text_write_real(file,instance_number(pMyGameObjects))
file_text_writeln(file)

//now look at all the children under parent pMyGameObjects
with pMyGameObjects
{
    file_text_write_real(file,object_index)
    file_text_writeln(file)
    
    file_text_write_real(file,x)
    file_text_writeln(file)
    
    file_text_write_real(file,y)
    file_text_writeln(file)
}

file_text_close(file)

  • 1


#4913577 Design Patterns and Principles in GameMaker (or: "Organising Code")

Posted by slayer 64 on 30 November 2015 - 11:11 PM

i like to start new projects and copy over code, organizing it in the process.
  • 0


#4912229 How can you select a 3d model using you mouse?

Posted by slayer 64 on 27 November 2015 - 10:25 PM

when working in 3d you should use vectors. a vector is a set of three variables, xyz. there's a lot of math involved, but by using vectors it all becomes much easier.

here's an example of ray tracing a plane using slayersUpgrade

create event
rayResult=-1

vRayResult=vecCreate(0,0,0)

//set camera
camRoty=-45
camRotz=315

vecSetxyz(oCamera.vPosition,0,0,100)
vecSetxyz(oCamera.vUp,0,0,1)
vecSetPitchYaw(oCamera.vForward,camRoty,camRotz)
step event
with oCamera
{
    //prepare for 2d 3d conversion
    screenConvertPrep(vPosition,vForward,vUp,fov,room_width,room_height)
}

//get mouse vector and store it in the globalvar variable vTempa
screenConvertToVector(vTempa,mouse_x,mouse_y)

//do some long distance ray tracing
global.rayTrace=9999999

with oPlane
{
    //a plane is defined by a position and normal vector
    m=rayTracePlaneCulled(vPosition,vNormal,oCamera.vPosition,vTempa)
    
    if m>0
    if m<global.rayTrace
    {
        global.rayTrace=m
    }
}

//if a ray trace was successful calculate the position
if global.rayTrace>0 
{
    rayResult=global.rayTrace
    vecAddScale(vRayResult,oCamera.vPosition,vTempa,rayResult)
}
draw event
if rayResult>0
{
    draw_set_color(c_red)
    d3dDrawBlock(vRayResult,2)
    draw_set_color(c_white)
}

  • 2


#4891862 Making money with game i made?

Posted by slayer 64 on 16 October 2015 - 01:42 AM

put your game on a cd in a box. that'll really blow people's minds.
  • 1


#4890834 ineed help about pseudo 3d collisions

Posted by slayer 64 on 14 October 2015 - 01:22 AM

you could use the all gml 3d solution slayers upgrade which has ray tracing and collision response scripts
  • 1


#4890831 instance_find is slow to loop through instances, what to use instead?

Posted by slayer 64 on 14 October 2015 - 01:13 AM

looping through a lot of stuff is never good. maybe your blocks can mark a cell in a grid as being filled, then you can round off the position of a bullet to see if it's hitting a block.
if ds_grid_get(gridBlocks,floor(x/blockSize),floor(y/blockSize)) //block is in this cell

  • 1


#4890828 I can't do basic maths (in GML)

Posted by slayer 64 on 14 October 2015 - 01:02 AM

what does this do for ya?
if x<0              x_target=room_width
if x>room_width     x_target=-room_width
if y<0              y_target=room_height
if y>room_height    y_target=-room_height

  • 1


#4886513 bending bullet direction

Posted by slayer 64 on 05 October 2015 - 11:39 PM

that didn't work either... my bullet works, but i wanted to make that bendin effect when the bullet reaches close to the player, like the video i put... idk if i can explain that well.

oh, you'll just need to add a simple distance check. it's in pixels. right now it's adding motion towards the player right away, so it's bending too early.
if distance_to_object(obj_player)<100
{
motion_add(point_direction(x,y,obj_player.x,obj_player.y),2)
speed=2
image_angle=direction
}

  • 1


#4885346 bending bullet direction

Posted by slayer 64 on 03 October 2015 - 08:50 PM

i think you can add motion to the bullet in it's step event. and then cap it's speed by setting it. gm will figured it out.
motion_add(point_direction(x,y,obj_player.x,obj_player.y),2)
speed=2
image_angle=direction

  • 1


#4866243 3D mouse checking?

Posted by slayer 64 on 31 August 2015 - 10:01 PM

this extension does collisions

https://marketplace....slayers-upgrade
  • 0


#4866241 How To Use 3D Normals

Posted by slayer 64 on 31 August 2015 - 09:56 PM

and you can use an extension with vector scripts in it that makes everything easier.

https://marketplace....slayers-upgrade
  • -1


#4861520 3D Collisions?

Posted by slayer 64 on 22 August 2015 - 02:44 PM

i have delved into this subject

https://marketplace....1307/fps-engine

http://host-a.net/u/.../fps_engine.exe
  • 1


#4826967 Refactor Tool

Posted by slayer 64 on 20 June 2015 - 02:35 PM

an exe included in the gmz i buy? huuuh. didn't know that was allowed. how so i know it's not a deadly virus? is the marketplace a house of cards?
  • -3


#4826162 3D physic

Posted by slayer 64 on 19 June 2015 - 12:06 AM

this example works great!

https://marketplace....1295/push-boxes
  • 0