Create Event:
//variable for turning
global.turned
Step Event:
if keyboard_check_pressed(button_right) {global.turned = 0}
if keyboard_check_pressed(button_left) {global.turned = 1}
End Step Event:
image_xscale = global.turned
- Game Maker Community
- → Viewing Profile: Topics: peldms63
peldms63
Member Since 10 Aug 2008Offline Last Active May 23 2012 08:41 PM
Community Stats
- Group New Member
- Active Posts 273
- Profile Views 722
- Member Title GMC Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
0
none
Topics I've Started
image_xscale crashes Game Maker
10 November 2010 - 11:20 AM
As often standard in games, I want the game to mirror my sprite. So I tried to use image_xscale as I used to do in GM7, but it crashed my game. Is the code bugged or am I doing something wrong?
Flipping gravity
09 November 2010 - 08:31 PM
In my game the character is suppose to be able to flip gravity around by pressing up and the jump button, but as soon as he hits the roof he gets stuck and all I can do is flip gravity again to get him off. Does anyone know why he gets stuck?
Create Event:
global.grav_switch = 270
button_right = vk_right
button_left = vk_left
button_up = vk_up
button_jump = ord("Z")
Step Event:
gravity_direction = global.grav_switch
if keyboard_check_pressed(button_jump) and keyboard_check(button_up)
{
if global.grav_switch = 270 {global.grav_switch = 90 exit}
if global.grav_switch = 90 {global.grav_switch = 270 exit}
}
if global.grav_switch = 270
{
button_up = vk_up
if place_free(x,y+1) {gravity = 0.5} else {gravity = 0}
if keyboard_check(button_left) && place_free(x-3,y) {x-=3}
if keyboard_check(button_right) && place_free(x+3,y) {x+=3}
if keyboard_check_pressed(button_jump) && !place_free(x,y+1) {vspeed = -8}
if keyboard_check_released(button_jump) vspeed = max(0, -8)
if vspeed > 10 {vspeed = 10}
}
if global.grav_switch = 90
{
button_up = vk_down
if place_free(x,y-1) {gravity = -0.5} else {gravity = 0}
if keyboard_check(button_left) && place_free(x-3,y) {x-=3}
if keyboard_check(button_right) && place_free(x+3,y) {x+=3}
if keyboard_check_pressed(button_jump) && !place_free(x,y-1) {vspeed = 8}
if keyboard_check_released(button_jump) vspeed = max(0, 8)
if vspeed > -10 {vspeed = -10}
}
Collision with obj_solid:
if global.grav_switch = 270
{
if vspeed > 0 && !place_free(x,y+vspeed)
{move_contact(270) vspeed = 0}
}
if global.grav_switch = 90
{
if vspeed < 0 && !place_free(x,y-vspeed)
{move_contact(90) vspeed = 0}
}
Varied jump
09 November 2010 - 07:36 PM
I remember having a engine where you when you jumped, the longer you held the button pressed the higher the player would jump. Now I've searched my entire computer and I can't find it, so I decided to ask here. Is there a good code for such jumping?
Curently using this moving code:
Curently using this moving code:
gravity_direction = global.grav_switch
if place_free(x,y+1) {gravity = 0.5} else {gravity = 0}
if keyboard_check(button_left) && place_free(x-3,y) {x-=3}
if keyboard_check(button_right) && place_free(x+3,y) {x+=3}
if keyboard_check_pressed(button_up) && !place_free(x,y+1) {vspeed = -8}
if vspeed > 10 {vspeed = 10}
Skybox doesn't work
22 October 2010 - 09:25 PM
I'm trying to make a 3D game and I'm trying to make a skybox around the room with night sky textures. But as I'm new to 3D, I still don't quite understand how everything works and I can't seem to be able to make it work. Does anyone know how?
I'm using a texture that's 256x256
I'm using a texture that's 256x256
Create Event: skyball = d3d_model_ellipsoid(d3d_model_create(),0,0,0,room_width, room_height,700,1,2,12); Draw Event: d3d_model_draw(skyball,0,0,0,background_get_texture(texture_sky));
Stuck in Slopes
18 August 2010 - 02:24 PM
I'm trying to make slopes in my game, but there seems to be a problem in the movement code I'm using and I don't know what the problem is. The player gets stuck if it tries to walk up slopes and if you jump up on the slope, you get stuck after just walking a few pixels. This is the code:
Please help me find the problem.
if place_free(x,y+1) && !place_meeting(x,y,obj_ladder) {gravity = 0.5} else {gravity = 0}
if keyboard_check(vk_left) && place_free(x-4,y) && ducking = 0 {x-=3}
if keyboard_check(vk_right) && place_free(x+4,y) && ducking = 0 {x+=3}
if keyboard_check_pressed(vk_up) && !place_free(x,y+1) && !place_meeting(x,y,obj_ladder) {vspeed = -8}
if place_meeting(x,y,obj_ladder) && keyboard_check(vk_up) {y-=4}
if place_meeting(x,y,obj_ladder) && keyboard_check(vk_down) {y+=4}
if vspeed > 10 {vspeed = 10}
if place_meeting(x,y,obj_ladder) && !keyboard_check(vk_up) {vspeed = 0}
if place_meeting(x,y,obj_ladder) {vspeed = 0}
if keyboard_check(vk_right) {if place_meeting(x+1,y,obj_slope_r) {if place_free(x+1,y-1) {x+=3 y-=4}}}
if keyboard_check(vk_left) {if place_meeting(x-1,y,obj_slope_r) {if place_free(x-1,y-1) {x-=3 y-=4}}}
The player mask is 8x16 and the slopes are 16x16.Please help me find the problem.
- Game Maker Community
- → Viewing Profile: Topics: peldms63
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content